FreeHEP API
Version current

org.freehep.util.io
Class ByteCountInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.freehep.util.io.DecompressableInputStream
          extended byorg.freehep.util.io.BitInputStream
              extended byorg.freehep.util.io.ByteOrderInputStream
                  extended byorg.freehep.util.io.ByteCountInputStream
All Implemented Interfaces:
DataInput
Direct Known Subclasses:
TaggedInputStream

public class ByteCountInputStream
extends ByteOrderInputStream

The input buffer can be limited to less than the number of bytes of the underlying buffer. Only one real input stream exists, which is where the reads take place. A buffer is limited by some length. If more is read, -1 is returned. Multiple limits can be set by calling pushBuffer. If bytes are left in the buffer when popBuffer is called, they are returned in an array. Otherwise null is returned.

Version:
$Id: ByteCountInputStream.java,v 1.4 2003/12/01 16:54:19 duns Exp $
Author:
Mark Donszelmann, Charles Loomis
Source Code:
ByteCountInputStream.java

Field Summary
 
Fields inherited from class org.freehep.util.io.ByteOrderInputStream
little
 
Fields inherited from class org.freehep.util.io.BitInputStream
BIT_MASK, FIELD_MASK, MASK_SIZE, ONES, ZERO
 
Constructor Summary
ByteCountInputStream(InputStream in, boolean littleEndian, int stackDepth)
           
 
Method Summary
 long getLength()
           
 byte[] popBuffer()
           
 void pushBuffer(int len)
           
 int read()
           
 
Methods inherited from class org.freehep.util.io.ByteOrderInputStream
readAsciiZString, readBoolean, readByte, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readInt, readLine, readLong, readShort, readShort, readString, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedShort, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from class org.freehep.util.io.BitInputStream
byteAlign, fetchByte, readBitFlag, readFBits, readSBits, readUBits
 
Methods inherited from class org.freehep.util.io.DecompressableInputStream
skip, startDecompressing
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteCountInputStream

public ByteCountInputStream(InputStream in,
                            boolean littleEndian,
                            int stackDepth)
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class DecompressableInputStream
Throws:
IOException

pushBuffer

public void pushBuffer(int len)

popBuffer

public byte[] popBuffer()
                 throws IOException
Returns:
null if buffer was completely read. Otherwise rest of buffer is read and returned.
Throws:
IOException

getLength

public long getLength()

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.