Package com.google.api.client.util
Class LoggingStreamingContent
- java.lang.Object
-
- com.google.api.client.util.LoggingStreamingContent
-
- All Implemented Interfaces:
StreamingContent
public final class LoggingStreamingContent extends java.lang.Object implements StreamingContent
Wraps another streaming content without modifying the content, but also logging content usingLoggingOutputStream.Implementation is not thread-safe.
- Since:
- 1.14
-
-
Field Summary
Fields Modifier and Type Field Description private StreamingContentcontentStreaming content.private intcontentLoggingLimitMaximum number of bytes to log or0to avoid logging content.private java.util.logging.LoggerloggerLogger.private java.util.logging.LevelloggingLevelLogging level.
-
Constructor Summary
Constructors Constructor Description LoggingStreamingContent(StreamingContent content, java.util.logging.Logger logger, java.util.logging.Level loggingLevel, int contentLoggingLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwriteTo(java.io.OutputStream out)Writes the byte content to the given output stream.
-
-
-
Field Detail
-
content
private final StreamingContent content
Streaming content.
-
contentLoggingLimit
private final int contentLoggingLimit
Maximum number of bytes to log or0to avoid logging content.
-
loggingLevel
private final java.util.logging.Level loggingLevel
Logging level.
-
logger
private final java.util.logging.Logger logger
Logger.
-
-
Constructor Detail
-
LoggingStreamingContent
public LoggingStreamingContent(StreamingContent content, java.util.logging.Logger logger, java.util.logging.Level loggingLevel, int contentLoggingLimit)
- Parameters:
content- streaming contentlogger- loggerloggingLevel- logging levelcontentLoggingLimit- maximum number of bytes to log or0to avoid logging content
-
-
Method Detail
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOExceptionDescription copied from interface:StreamingContentWrites the byte content to the given output stream.Implementations must not close the output stream, and instead should flush the output stream. Some callers may assume that the the output stream has not been closed, and will fail to work if it has been closed.
- Specified by:
writeToin interfaceStreamingContent- Parameters:
out- output stream- Throws:
java.io.IOException
-
-