Class LoggingInputStream (1.42.3)

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
NameDescription
inputStreamInputStream

input stream to forward all reads to

loggerLogger

logger

loggingLevelLevel

logging level

contentLoggingLimitint

maximum number of bytes to log (may be 0 to avoid logging content)

Methods

close()

public void close()
Overrides Exceptions
TypeDescription
IOException

getLogStream()

public final LoggingByteArrayOutputStream getLogStream()

Returns the log stream.

Returns
TypeDescription
LoggingByteArrayOutputStream

read()

public int read()
Returns
TypeDescription
int
Overrides Exceptions
TypeDescription
IOException

read(byte[] b, int off, int len)

public int read(byte[] b, int off, int len)
Parameters
NameDescription
bbyte[]
offint
lenint
Returns
TypeDescription
int
Overrides Exceptions
TypeDescription
IOException