Class LoggingStreamingContent

java.lang.Object
com.google.api.client.util.LoggingStreamingContent
All Implemented Interfaces:
StreamingContent

public final class LoggingStreamingContent extends Object implements StreamingContent
Wraps another streaming content without modifying the content, but also logging content using LoggingOutputStream.

Implementation is not thread-safe.

Since:
1.14
  • Field Details

    • content

      private final StreamingContent content
      Streaming content.
    • contentLoggingLimit

      private final int contentLoggingLimit
      Maximum number of bytes to log or 0 to avoid logging content.
    • loggingLevel

      private final Level loggingLevel
      Logging level.
    • logger

      private final Logger logger
      Logger.
  • Constructor Details

    • LoggingStreamingContent

      public LoggingStreamingContent(StreamingContent content, Logger logger, Level loggingLevel, int contentLoggingLimit)
      Parameters:
      content - streaming content
      logger - logger
      loggingLevel - logging level
      contentLoggingLimit - maximum number of bytes to log or 0 to avoid logging content
  • Method Details

    • writeTo

      public void writeTo(OutputStream out) throws IOException
      Description copied from interface: StreamingContent
      Writes 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 output stream has not been closed, and will fail to work if it has been closed.

      Specified by:
      writeTo in interface StreamingContent
      Parameters:
      out - output stream
      Throws:
      IOException