Methods Summary |
---|
public void | setQuote(boolean quote)Set quote mode.
this.quote = quote;
|
public void | setTrace(boolean trace)Set the trace mode.
this.trace = trace;
|
public void | write(int b)Writes the specified byte to this output stream.
Writes out the byte into the trace stream if the trace mode
is true
if (trace) {
if (quote)
writeByte(b);
else
traceOut.write(b);
}
out.write(b);
|
public void | write(byte[] b, int off, int len)Writes b.length bytes to this output stream.
Writes out the bytes into the trace stream if the trace
mode is true
if (trace) {
if (quote) {
for (int i = 0; i < len; i++)
writeByte(b[off + i]);
} else
traceOut.write(b, off, len);
}
out.write(b, off, len);
|
private final void | writeByte(int b)Write a byte in a way that every byte value is printable ASCII.
b &= 0xff;
if (b > 0x7f) {
traceOut.write('M");
traceOut.write('-");
b &= 0x7f;
}
if (b == '\r") {
traceOut.write('\\");
traceOut.write('r");
} else if (b == '\n") {
traceOut.write('\\");
traceOut.write('n");
traceOut.write('\n");
} else if (b == '\t") {
traceOut.write('\\");
traceOut.write('t");
} else if (b < ' ") {
traceOut.write('^");
traceOut.write('@" + b);
} else {
traceOut.write(b);
}
|