1
2 package org.freehep.graphicsio.swf;
3
4 import java.io.IOException;
5
6
7
8
9
10
11
12
13 public class DefineBits extends DefinitionTag {
14
15 private int character;
16
17 private byte[] data;
18
19
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 }