HexOutputStreampublic class HexOutputStream extends OutputStream Writes each input byte as a 2 byte hexidecimal output pair making it
possible to turn arbitrary binary data into an ASCII format.
The high 4 bits of the byte is translated into the first byte. |
Fields Summary |
---|
private static final char[] | hex | private StringWriter | writer |
Constructors Summary |
---|
public HexOutputStream(StringWriter w)Creates a new HexOutputStream.
writer = w;
|
Methods Summary |
---|
public synchronized void | write(int b)Writes a byte. Will block until the byte is actually
written.
param b The byte to write out.
writer.write(hex[((b >> 4) & 0xF)]);
writer.write(hex[((b >> 0) & 0xF)]);
| public synchronized void | write(byte[] b)
write(b, 0, b.length);
| public synchronized void | write(byte[] b, int off, int len)
for(int i=0; i < len; i++) {
write(b[off + i]);
}
|
|