Package com.batch.android.core
Class ForwardReadableInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.batch.android.core.ForwardReadableInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class ForwardReadableInputStream extends java.io.InputStreamInputStreamwrapper that allows one to read the first X bytes of an InputStream on non markable streams, and use the wrapped stream as if it wasn't ever read. This class will throw if the wrapped stream does not have enough bytes to read the wanted bytes.Calling
read()will be passed through the wrapped stream directly.IMPORTANT NOTE: This class does NOT forward .close() to the wrapped input stream.
-
-
Constructor Summary
Constructors Constructor Description ForwardReadableInputStream(java.io.InputStream is, int bytesToRead)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]getFirstBytes()Get the first bytes that have already been readintread()
-