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.InputStreamWraps 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 intavailable()voidclose()voidconsumeToEOF()byte[]getBytesRead()java.lang.StringgetString(java.lang.String encoding)booleanhasReachedEOF()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] buffer, int offset, int length)voidreset()
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buffer, int offset, int length) throws java.io.IOException- Overrides:
readin 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.UnsupportedEncodingExceptionBufferExceededException
-
hasReachedEOF
public boolean hasReachedEOF()
-
-