Package com.google.api.client.util
Class LoggingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.google.api.client.util.LoggingInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Thread-safe input stream wrapper that forwards all reads to a given input stream, while logging
all reads to a
LoggingByteArrayOutputStream
.- Since:
- 1.9
-
Field Summary
FieldsFields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsConstructorDescriptionLoggingInputStream
(InputStream inputStream, Logger logger, Level loggingLevel, int contentLoggingLimit) -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
-
Field Details
-
logStream
Log stream.
-
-
Constructor Details
-
LoggingInputStream
public LoggingInputStream(InputStream inputStream, Logger logger, Level loggingLevel, int contentLoggingLimit) - Parameters:
inputStream
- input stream to forward all reads tologger
- loggerloggingLevel
- logging levelcontentLoggingLimit
- maximum number of bytes to log (may be0
to avoid logging content)
-
-
Method Details
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
getLogStream
Returns the log stream.
-