Class LoggingInputStream (1.45.0)

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.

Inheritance

java.lang.Object > InputStream > FilterInputStream > LoggingInputStream

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 0 to avoid logging content)

Methods

close()

public void close()
Overrides
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
Overrides
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
Overrides
Exceptions
Type Description
IOException