FreeHEP API
Version current

org.freehep.util.io
Class TaggedOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byorg.freehep.util.io.CompressableOutputStream
              extended byorg.freehep.util.io.BitOutputStream
                  extended byorg.freehep.util.io.ByteOrderOutputStream
                      extended byorg.freehep.util.io.ByteCountOutputStream
                          extended byorg.freehep.util.io.TaggedOutputStream
All Implemented Interfaces:
DataOutput, FinishableOutputStream, TaggedOutput
Direct Known Subclasses:
CGMOutputStream, EMFOutputStream, SWFOutputStream

public abstract class TaggedOutputStream
extends ByteCountOutputStream
implements TaggedOutput

Class to write Tagged blocks to a Stream. The tagged blocks (Tags) contain a tagID and a Length, so that known and unknown tags (read with the TaggedInputStream) can again be written. The stream also allows to write Actions, which again come with a actionCode and a length. A concrete implementation of this stream should encode/write the TagHeader. All Concrete tags should be inherited from the Tag class and implement their write methods.

Version:
$Id: TaggedOutputStream.java,v 1.11 2003/05/05 00:35:33 duns Exp $
Author:
Mark Donszelmann, Charles Loomis
Source Code:
TaggedOutputStream.java

Field Summary
protected  ActionSet actionSet
          Set of actions that can be used by this Stream
protected  TagSet tagSet
          Set of tags that can be used by this Stream
 
Fields inherited from class org.freehep.util.io.ByteOrderOutputStream
little, written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
TaggedOutputStream(OutputStream out, TagSet tagSet, ActionSet actionSet)
           
TaggedOutputStream(OutputStream out, TagSet tagSet, ActionSet actionSet, boolean littleEndian)
           
 
Method Summary
protected  int getTagAlignment()
          Specifies tag alignment 1 byte 2 short 4 int 8 long
 void writeAction(Action action)
           
protected abstract  void writeActionHeader(ActionHeader header)
          Writes the ActionHeader, which includes an actionCode and a length
 void writeTag(Tag tag)
          Write a tag.
protected abstract  void writeTagHeader(TagHeader header)
          Writes the TagHeader, which includes a TagID and a length
 
Methods inherited from class org.freehep.util.io.ByteCountOutputStream
append, close, getBufferLength, getLength, popBuffer, popBufferBytes, pushBuffer, write
 
Methods inherited from class org.freehep.util.io.ByteOrderOutputStream
size, writeAsciiZString, writeBoolean, writeByte, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeInt, writeLong, writeShort, writeShort, writeString, writeUnsignedByte, writeUnsignedByte, writeUnsignedInt, writeUnsignedInt, writeUnsignedShort, writeUnsignedShort, writeUTF, writeUTF
 
Methods inherited from class org.freehep.util.io.BitOutputStream
byteAlign, finish, flushByte, minBits, minBits, minBits, writeBitFlag, writeFBits, writeSBits, writeUBits
 
Methods inherited from class org.freehep.util.io.CompressableOutputStream
startCompressing, write
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.freehep.util.io.TaggedOutput
close
 
Methods inherited from interface java.io.DataOutput
write, write
 

Field Detail

tagSet

protected TagSet tagSet
Set of tags that can be used by this Stream


actionSet

protected ActionSet actionSet
Set of actions that can be used by this Stream

Constructor Detail

TaggedOutputStream

public TaggedOutputStream(OutputStream out,
                          TagSet tagSet,
                          ActionSet actionSet)

TaggedOutputStream

public TaggedOutputStream(OutputStream out,
                          TagSet tagSet,
                          ActionSet actionSet,
                          boolean littleEndian)
Method Detail

writeTagHeader

protected abstract void writeTagHeader(TagHeader header)
                                throws IOException
Writes the TagHeader, which includes a TagID and a length

Throws:
IOException

getTagAlignment

protected int getTagAlignment()
Specifies tag alignment 1 byte 2 short 4 int 8 long


writeTag

public void writeTag(Tag tag)
              throws IOException
Write a tag.

Specified by:
writeTag in interface TaggedOutput
Throws:
IOException

writeActionHeader

protected abstract void writeActionHeader(ActionHeader header)
                                   throws IOException
Writes the ActionHeader, which includes an actionCode and a length

Throws:
IOException

writeAction

public void writeAction(Action action)
                 throws IOException
Throws:
IOException

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.