Package com.sun.mail.util
Class TraceInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.sun.mail.util.TraceInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class TraceInputStream extends java.io.FilterInputStreamThis class is a FilterInputStream that writes the bytes being read from the given input stream into the given output stream. This class is typically used to provide a trace of the data that is being retrieved from an input stream.
-
-
Constructor Summary
Constructors Constructor Description TraceInputStream(java.io.InputStream in, MailLogger logger)Creates an input stream filter built on top of the specified input stream.TraceInputStream(java.io.InputStream in, java.io.OutputStream traceOut)Creates an input stream filter built on top of the specified input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intread()Reads the next byte of data from this input stream.intread(byte[] b, int off, int len)Reads up tolenbytes of data from this input stream into an array of bytes.voidsetQuote(boolean quote)Set quote mode.voidsetTrace(boolean trace)Set trace mode.-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
-
-
-
-
Constructor Detail
-
TraceInputStream
public TraceInputStream(java.io.InputStream in, MailLogger logger)Creates an input stream filter built on top of the specified input stream.- Parameters:
in- the underlying input stream.logger- log trace here
-
TraceInputStream
public TraceInputStream(java.io.InputStream in, java.io.OutputStream traceOut)Creates an input stream filter built on top of the specified input stream.- Parameters:
in- the underlying input stream.traceOut- the trace stream.
-
-
Method Detail
-
setTrace
public void setTrace(boolean trace)
Set trace mode.- Parameters:
trace- the trace mode
-
setQuote
public void setQuote(boolean quote)
Set quote mode.- Parameters:
quote- the quote mode
-
read
public int read() throws java.io.IOExceptionReads the next byte of data from this input stream. Returns-1if no data is available. Writes out the read byte into the trace stream, if trace mode istrue- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOExceptionReads up tolenbytes of data from this input stream into an array of bytes. Returns-1if no more data is available. Writes out the read bytes into the trace stream, if trace mode istrue- Overrides:
readin classjava.io.FilterInputStream- Throws:
java.io.IOException
-
-