MCPcopy Create free account
hub / github.com/M66B/FairEmail / TraceOutputStream

Class TraceOutputStream

app/src/main/java/com/sun/mail/util/TraceOutputStream.java:31–179  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

29 */
30
31public class TraceOutputStream extends FilterOutputStream {
32 private boolean trace = false;
33 private boolean quote = false;
34 private OutputStream traceOut;
35
36 private long pos = 0;
37 private long base = 0;
38 private int last = 0;
39 private int total = 0;
40 private IReport reporter = null;
41
42 /**
43 * Creates an output stream filter built on top of the specified
44 * underlying output stream.
45 *
46 * @param out the underlying output stream.
47 * @param logger log trace here
48 */
49 public TraceOutputStream(OutputStream out, MailLogger logger) {
50 super(out);
51 this.trace = logger.isLoggable(Level.FINEST);
52 this.traceOut = new LogOutputStream(logger);;
53 }
54
55 /**
56 * Creates an output stream filter built on top of the specified
57 * underlying output stream.
58 *
59 * @param out the underlying output stream.
60 * @param traceOut the trace stream.
61 */
62 public TraceOutputStream(OutputStream out, OutputStream traceOut) {
63 super(out);
64 this.traceOut = traceOut;
65 }
66
67 /**
68 * Set the trace mode.
69 *
70 * @param trace the trace mode
71 */
72 public void setTrace(boolean trace) {
73 this.trace = trace;
74 }
75
76 /**
77 * Set quote mode.
78 * @param quote the quote mode
79 */
80 public void setQuote(boolean quote) {
81 this.quote = quote;
82 }
83
84 /**
85 * Writes the specified <code>byte</code> to this output stream.
86 * Writes out the byte into the trace stream if the trace mode
87 * is <code>true</code>
88 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected