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, skippublic HeadBufferingStream(InputStream in, int sideBufferSize)
public int read()
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamIOExceptionpublic void fillSide()
throws IOException
IOExceptionpublic byte[] getSideBuffer()
Copyright © 2019. All rights reserved.