Debian Codegraph @

freehep-graphicsio-swf/src/main/java/org/freehep/graphicsio/swf/DefineBits.java

raw symbols SCIP
1 // Copyright 2001, FreeHEP.
2 package org.freehep.graphicsio.swf;
3
4 import java.io.IOException;
5
6 /**
7 * DefineBits TAG.
8 *
9 * @author Mark Donszelmann
10 * @author Charles Loomis
11 * @version $Id: freehep-graphicsio-swf/src/main/java/org/freehep/graphicsio/swf/DefineBits.java db861da05344 2005/12/05 00:59:43 duns $
12 */
13 public class DefineBits extends DefinitionTag {
14
15 private int character;
16
17 private byte[] data;
18
19 // private BufferedImage image;
20
21 public DefineBits() {
22 super(6, 1);
23 }
24
25 public SWFTag read(int tagID, SWFInputStream swf, int len)
26 throws IOException {
27
28 DefineBits tag = new DefineBits();
29 tag.character = swf.readUnsignedShort();
30 swf.getDictionary().put(tag.character, tag);
31
32 tag.data = swf.readByte(len - 2);
33
34 return tag;
35 }
36
37 public void write(int tagID, SWFOutputStream swf) throws IOException {
38
39 swf.writeUnsignedShort(character);
40 swf.writeByte(data);
41 }
42
43 public String toString() {
44 StringBuffer s = new StringBuffer();
45 s.append(super.toString() + "\n");
46 s.append(" character: " + character + "\n");
47 s.append(" length: " + data.length + "\n");
48 return s.toString();
49 }
50 }