Package pixy.io
Class PeekHeadInputStream
java.lang.Object
java.io.InputStream
pixy.io.PeekHeadInputStream
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class PeekHeadInputStream
extends java.io.InputStream
Lightweight stream wrapper which allows to peek a
fixed length of bytes from the current stream head
-
Constructor Summary
Constructors Constructor Description PeekHeadInputStream(java.io.InputStream src, int bytesToPeek) -
Method Summary
Modifier and Type Method Description voidclose()byte[]peek(int len)intread()intread(byte[] b, int off, int len)voidshallowClose()
-
Constructor Details
-
PeekHeadInputStream
public PeekHeadInputStream(java.io.InputStream src, int bytesToPeek)- Parameters:
bytesToPeek- number of bytes to peeksrc- The source InputStream to use
-
-
Method Details
-
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
-
shallowClose
public void shallowClose() throws java.io.IOException- Throws:
java.io.IOException
-
peek
public byte[] peek(int len) throws java.io.IOException- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-