Package network.oxalis.commons.io
Class PeekingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- network.oxalis.commons.io.PeekingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class PeekingInputStream extends InputStream
Caching InputStream to be used when reading the beginning of a stream is needed before the stream is "reset" when the exact amount of data is unknown and support for marking of is irrelevant.- Since:
- 4.0.0
- Author:
- erlend
-
-
Constructor Summary
Constructors Constructor Description PeekingInputStream(InputStream sourceInputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getContent()InputStreamnewInputStream()intread()-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
PeekingInputStream
public PeekingInputStream(InputStream sourceInputStream) throws IOException
- Throws:
IOException
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
getContent
public byte[] getContent()
-
newInputStream
public InputStream newInputStream() throws IOException
- Throws:
IOException
-
-