public class HeadBufferingStream extends FilterInputStream
FilterInputStream
that buffers the first N bytes to a byte array on the side.
This byte array can be then accessed later.
Useful for sniffing the content of the stream after the error is discovered.
in
Constructor and Description |
---|
HeadBufferingStream(InputStream in,
int sideBufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
fillSide()
Read until we fill up the side buffer.
|
byte[] |
getSideBuffer()
Gets the side buffer content.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
available, close, mark, markSupported, read, reset, skip
public HeadBufferingStream(InputStream in, int sideBufferSize)
public int read() throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
IOException
public void fillSide() throws IOException
IOException
public byte[] getSideBuffer()
Copyright © 2016. All rights reserved.