edu.rice.cs.cunit.util
Class PositionDataInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.DataInputStream
              extended by edu.rice.cs.cunit.util.PositionDataInputStream
All Implemented Interfaces:
ProvidesInputStreamPosition, java.io.Closeable, java.io.DataInput

public final class PositionDataInputStream
extends java.io.DataInputStream
implements ProvidesInputStreamPosition

A DataInputStream that makes the position in the stream available.


Field Summary
protected  PositionInputStream _in
          Delegee.
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
PositionDataInputStream(PositionInputStream in)
          Create a new PositionInputStream based on the stream given.
 
Method Summary
 long getPosition()
          Get the stream position.
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_in

protected PositionInputStream _in
Delegee.

Constructor Detail

PositionDataInputStream

public PositionDataInputStream(PositionInputStream in)
Create a new PositionInputStream based on the stream given.

Parameters:
in - input stream
Method Detail

getPosition

public long getPosition()

Get the stream position.

Eventually, the position will roll over to a negative number. Reading 1 Tb per second, this would occur after approximately three months. Applications should account for this possibility in their design.

Specified by:
getPosition in interface ProvidesInputStreamPosition
Returns:
the current stream position.