Package org.lobobrowser.util.io
Class RecordedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.lobobrowser.util.io.RecordedInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class RecordedInputStream extends java.io.InputStream
Wraps an InputStream and records all of the bytes read. This stream supports mark() and reset().Note: Buffered streams should wrap this class as opposed to the other way around.
- Author:
- J. H. S.
-
-
Constructor Summary
Constructors Constructor Description RecordedInputStream(java.io.InputStream delegate, int maxBufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
consumeToEOF()
byte[]
getBytesRead()
java.lang.String
getString(java.lang.String encoding)
boolean
hasReachedEOF()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] buffer, int offset, int length)
void
reset()
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] buffer, int offset, int length) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
consumeToEOF
public void consumeToEOF() throws java.io.IOException
- Throws:
java.io.IOException
-
getBytesRead
public byte[] getBytesRead() throws BufferExceededException
- Throws:
BufferExceededException
-
getString
public java.lang.String getString(java.lang.String encoding) throws java.io.UnsupportedEncodingException, BufferExceededException
- Throws:
java.io.UnsupportedEncodingException
BufferExceededException
-
hasReachedEOF
public boolean hasReachedEOF()
-
-