com.google.api.client.util
Class LoggingOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.google.api.client.util.LoggingOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class LoggingOutputStream
- extends FilterOutputStream
Thread-safe output stream wrapper that forwards all writes to a given output stream, while
logging all writes to a LoggingByteArrayOutputStream
.
- Since:
- 1.9
- Author:
- Yaniv Inbar
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 be 0
to avoid logging
content)
write
public void write(int b)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class FilterOutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class FilterOutputStream
- Throws:
IOException
getLogStream
public final LoggingByteArrayOutputStream getLogStream()
- Returns the log stream.
Copyright © 2011-2012 Google. All Rights Reserved.