net.sf.freecol.common.util
Class ReplayableInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by net.sf.freecol.common.util.ReplayableInputStream
All Implemented Interfaces:
java.io.Closeable

public final class ReplayableInputStream
extends java.io.InputStream

Wraps a InputStream and adds InputStream.mark(int) and InputStream.reset() support.


Field Summary
private static int NORMAL
           
private  int recordedBytes
           
private static int RECORDING
           
private  byte[] replayBuffer
           
private  int replayedBytes
           
private static int REPLAYING
           
private  int state
           
private  java.io.InputStream underlyingStream
           
 
Constructor Summary
ReplayableInputStream(java.io.InputStream in)
           
 
Method Summary
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 void reset()
           
 
Methods inherited from class java.io.InputStream
available, close, read, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL

private static final int NORMAL
See Also:
Constant Field Values

RECORDING

private static final int RECORDING
See Also:
Constant Field Values

REPLAYING

private static final int REPLAYING
See Also:
Constant Field Values

underlyingStream

private final java.io.InputStream underlyingStream

state

private int state

replayBuffer

private byte[] replayBuffer

recordedBytes

private int recordedBytes

replayedBytes

private int replayedBytes
Constructor Detail

ReplayableInputStream

public ReplayableInputStream(java.io.InputStream in)
Method Detail

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException