Top Description Fields Constructors Methods
com.sun.mail.util

public Class TraceInputStream

extends FilterInputStream
Class Inheritance
Imports
java.io.*, java.util.logging.Level

This 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.
Author
John Mani

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private OutputStream
Inherited from java.io.FilterInputStream:
in

Constructor Summary

AccessConstructor and Description
public
TraceInputStream(InputStream
the underlying input stream.
in
,
MailLogger
log trace here
logger
)

Creates an input stream filter built on top of the specified input stream.

public
TraceInputStream(InputStream
the underlying input stream.
in
,
OutputStream
the trace stream.
traceOut
)

Creates an input stream filter built on top of the specified input stream.

Method Summary

Modifier and TypeMethod and Description
public int
read()

Overrides java.io.FilterInputStream.read.

Reads the next byte of data from this input stream.
public int
read(byte[]
the buffer into which the data is read.
b
,
int
the start offset in array b at which the data is written.
off
,
int
the maximum number of bytes to read.
len
)

Overrides java.io.FilterInputStream.read.

Reads up to len bytes of data from this input stream into an array of bytes.
public void
setQuote(boolean
the quote mode
quote
)

Set quote mode.

public void
setTrace(boolean
the trace mode
trace
)

Set trace mode.

private final void
writeByte(int b)

Write a byte in a way that every byte value is printable ASCII.

Inherited from java.io.FilterInputStream:
availableclosemarkmarkSupportedreadresetskip

Field Detail

quoteback to summary
private boolean quote
traceback to summary
private boolean trace
traceOutback to summary
private OutputStream traceOut

Constructor Detail

TraceInputStreamback to summary
public TraceInputStream(InputStream in, MailLogger logger)

Creates an input stream filter built on top of the specified input stream.

Parameters
in:InputStream

the underlying input stream.

logger:MailLogger

log trace here

TraceInputStreamback to summary
public TraceInputStream(InputStream in, OutputStream traceOut)

Creates an input stream filter built on top of the specified input stream.

Parameters
in:InputStream

the underlying input stream.

traceOut:OutputStream

the trace stream.

Method Detail

readback to summary
public int read() throws IOException

Overrides java.io.FilterInputStream.read.

Reads the next byte of data from this input stream. Returns -1 if no data is available. Writes out the read byte into the trace stream, if trace mode is true

Returns:int

Doc from java.io.FilterInputStream.read.

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.read.

if an I/O error occurs.

readback to summary
public int read(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterInputStream.read.

Reads up to len bytes of data from this input stream into an array of bytes. Returns -1 if no more data is available. Writes out the read bytes into the trace stream, if trace mode is true

Parameters
b:byte[]

Doc from java.io.FilterInputStream.read.

the buffer into which the data is read.

off:int

Doc from java.io.FilterInputStream.read.

the start offset in array b at which the data is written.

len:int

Doc from java.io.FilterInputStream.read.

the maximum number of bytes to read.

Returns:int

Doc from java.io.FilterInputStream.read.

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.FilterInputStream.read.

if an I/O error occurs.

setQuoteback to summary
public void setQuote(boolean quote)

Set quote mode.

Parameters
quote:boolean

the quote mode

setTraceback to summary
public void setTrace(boolean trace)

Set trace mode.

Parameters
trace:boolean

the trace mode

writeByteback to summary
private final void writeByte(int b) throws IOException

Write a byte in a way that every byte value is printable ASCII.