Package com.google.api.client.util
Class LoggingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.google.api.client.util.LoggingOutputStream
-
public class LoggingOutputStream extends FilterOutputStream
Thread-safe output stream wrapper that forwards all writes to a given output stream, while logging all writes to aLoggingByteArrayOutputStream.- Since:
- 1.9
- Author:
- Yaniv Inbar
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description LoggingOutputStream(OutputStream outputStream, Logger logger, Level loggingLevel, int contentLoggingLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()LoggingByteArrayOutputStreamgetLogStream()Returns the log stream.voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.FilterOutputStream
flush, write
-
-
-
-
Constructor Detail
-
LoggingOutputStream
public LoggingOutputStream(OutputStream outputStream, Logger logger, Level loggingLevel, int contentLoggingLimit)
- Parameters:
outputStream- output stream to forward all writes tologger- loggerloggingLevel- logging levelcontentLoggingLimit- maximum number of bytes to log (may be0to avoid logging content)
-
-
Method Detail
-
write
public void write(int b) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
getLogStream
public final LoggingByteArrayOutputStream getLogStream()
Returns the log stream.
-
-