Methods Summary |
---|
public int | 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
int b = in.read();
if (trace && b != -1) {
if (quote)
writeByte(b);
else
traceOut.write(b);
}
return b;
|
public int | read(byte[] b, int off, int len)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
int count = in.read(b, off, len);
if (trace && count != -1) {
if (quote) {
for (int i = 0; i < count; i++)
writeByte(b[off + i]);
} else
traceOut.write(b, off, count);
}
return count;
|
public void | setQuote(boolean quote)Set quote mode.
this.quote = quote;
|
public void | setTrace(boolean trace)Set trace mode.
this.trace = trace;
|
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);
}
|