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

public Class TraceOutputStream

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

This class is a subclass of DataOutputStream that copies the data being written into the DataOutputStream into another output stream. This class is used here to provide a debug trace of the stuff thats being written out into the DataOutputStream.
Author
John Mani

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private OutputStream
Inherited from java.io.FilterOutputStream:
out

Constructor Summary

AccessConstructor and Description
public
TraceOutputStream(OutputStream
the underlying output stream.
out
,
MailLogger
log trace here
logger
)

Creates an output stream filter built on top of the specified underlying output stream.

public
TraceOutputStream(OutputStream
the underlying output stream.
out
,
OutputStream
the trace stream.
traceOut
)

Creates an output stream filter built on top of the specified underlying output stream.

Method Summary

Modifier and TypeMethod and Description
public void
setQuote(boolean
the quote mode
quote
)

Set quote mode.

public void
setTrace(boolean
the trace mode
trace
)

Set the trace mode.

public void
write(int
the byte to write
b
)

Overrides java.io.FilterOutputStream.write.

Writes the specified byte to this output stream.
public void
write(byte[]
bytes to write
b
,
int
offset in array
off
,
int
number of bytes to write
len
)

Overrides java.io.FilterOutputStream.write.

Writes b.length bytes to this output stream.
private final void
writeByte(int b)

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

Inherited from java.io.FilterOutputStream:
closeflushwrite

Field Detail

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

Constructor Detail

TraceOutputStreamback to summary
public TraceOutputStream(OutputStream out, MailLogger logger)

Creates an output stream filter built on top of the specified underlying output stream.

Parameters
out:OutputStream

the underlying output stream.

logger:MailLogger

log trace here

TraceOutputStreamback to summary
public TraceOutputStream(OutputStream out, OutputStream traceOut)

Creates an output stream filter built on top of the specified underlying output stream.

Parameters
out:OutputStream

the underlying output stream.

traceOut:OutputStream

the trace stream.

Method Detail

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 the trace mode.

Parameters
trace:boolean

the trace mode

writeback to summary
public void write(int b) throws IOException

Overrides java.io.FilterOutputStream.write.

Writes the specified byte to this output stream. Writes out the byte into the trace stream if the trace mode is true

Parameters
b:int

the byte to write

Annotations
@Override
Exceptions
IOException:
for I/O errors
writeback to summary
public void write(byte[] b, int off, int len) throws IOException

Overrides java.io.FilterOutputStream.write.

Writes b.length bytes to this output stream. Writes out the bytes into the trace stream if the trace mode is true

Parameters
b:byte[]

bytes to write

off:int

offset in array

len:int

number of bytes to write

Annotations
@Override
Exceptions
IOException:
for I/O errors
writeByteback to summary
private final void writeByte(int b) throws IOException

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