org.freehep.util.io
Class Tag

java.lang.Object
  extended by org.freehep.util.io.Tag
Direct Known Subclasses:
UndefinedTag

public abstract class Tag
extends Object

Generic Tag to be used by TaggedIn/OutputStreams. The tag contains an ID, name and a version. Concrete subclasses should implement the IO Read and Write methods.

Version:
$Id: Tag.java 8584 2006-08-10 23:06:37Z duns $
Author:
Mark Donszelmann, Charles Loomis

Field Summary
static int DEFAULT_TAG
          This is the tagID for the default tag handler.
 
Constructor Summary
protected Tag(int tagID, int version)
           
 
Method Summary
 String getName()
          Get the tag name.
 int getTag()
          Get the tag number.
 int getTagType()
          This returns the type of block
 int getVersion()
          Get the version number.
abstract  Tag read(int tagID, TaggedInputStream input, int len)
          This reads the information from the given input and returns a new Tag
abstract  String toString()
           
abstract  void write(int tagID, TaggedOutputStream output)
          This writes the information to the given output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TAG

public static final int DEFAULT_TAG
This is the tagID for the default tag handler.

See Also:
Constant Field Values
Constructor Detail

Tag

protected Tag(int tagID,
              int version)
Method Detail

getTag

public int getTag()
Get the tag number.

Returns:
tagID

getVersion

public int getVersion()
Get the version number.

Returns:
version number

getName

public String getName()
Get the tag name.

Returns:
tag name

getTagType

public int getTagType()
This returns the type of block

Returns:
tag type

read

public abstract Tag read(int tagID,
                         TaggedInputStream input,
                         int len)
                  throws IOException
This reads the information from the given input and returns a new Tag

Parameters:
tagID - id of the tag to read
input - stream to read from
len - length to read
Returns:
read Tag
Throws:
IOException - if read fails

write

public abstract void write(int tagID,
                           TaggedOutputStream output)
                    throws IOException
This writes the information to the given output

Parameters:
tagID - id of tag to write
output - stream to write to
Throws:
IOException - if write fails

toString

public abstract String toString()
Overrides:
toString in class Object


Copyright © 2000-2007 FreeHEP. All Rights Reserved.