View Javadoc

1   // Copyright 2001, FreeHEP.
2   package org.freehep.graphicsio.swf;
3   
4   import java.io.IOException;
5   
6   /**
7    * FrameLabel TAG.
8    * 
9    * @author Mark Donszelmann
10   * @author Charles Loomis
11   * @version $Id: FrameLabel.java 8584 2006-08-10 23:06:37Z duns $
12   */
13  public class FrameLabel extends ControlTag {
14  
15      private String label;
16  
17      private boolean anchor;
18  
19      public FrameLabel(String label) {
20          this(label, false);
21      }
22  
23      public FrameLabel(String label, boolean anchor) {
24          this();
25          this.label = label;
26          this.anchor = anchor;
27      }
28  
29      public FrameLabel() {
30          super(43, 3);
31      }
32  
33      public SWFTag read(int tagID, SWFInputStream swf, int len)
34              throws IOException {
35  
36          FrameLabel tag = new FrameLabel();
37          tag.label = swf.readString();
38          anchor = (swf.getVersion() > 6) ? (swf.readUnsignedByte() != 0) : false;
39          return tag;
40      }
41  
42      public void write(int tagID, SWFOutputStream swf) throws IOException {
43          swf.writeString(label);
44          swf.writeUnsignedByte((swf.getVersion() > 6) ? anchor ? 1 : 0 : 0);
45      }
46  
47      public String toString() {
48          return super.toString() + "\n" + "  frame label: " + label + "\n"
49                  + "  anchor: " + anchor;
50      }
51  }