public class LoggingInputStream extends FilterInputStream
Thread-safe input stream wrapper that forwards all reads to a given input stream, while logging all reads to a LoggingByteArrayOutputStream.
Constructors
LoggingInputStream(InputStream inputStream, Logger logger, Level loggingLevel, int contentLoggingLimit)
public LoggingInputStream(InputStream inputStream, Logger logger, Level loggingLevel, int contentLoggingLimit)
Parameters | |
---|---|
Name | Description |
inputStream |
InputStream input stream to forward all reads to |
logger |
Logger logger |
loggingLevel |
Level logging level |
contentLoggingLimit |
int maximum number of bytes to log (may be |
Methods
close()
public void close()
Exceptions | |
---|---|
Type | Description |
IOException |
getLogStream()
public final LoggingByteArrayOutputStream getLogStream()
Returns the log stream.
Returns | |
---|---|
Type | Description |
LoggingByteArrayOutputStream |
read()
public int read()
Returns | |
---|---|
Type | Description |
int |
Exceptions | |
---|---|
Type | Description |
IOException |
read(byte[] b, int off, int len)
public int read(byte[] b, int off, int len)
Parameters | |
---|---|
Name | Description |
b |
byte[] |
off |
int |
len |
int |
Returns | |
---|---|
Type | Description |
int |
Exceptions | |
---|---|
Type | Description |
IOException |