public class HexDumpEncoder
extends java.lang.Object
xxxx: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ................Where xxxx is the offset into the buffer in 16 byte chunks, followed by ascii coded hexadecimal bytes followed by the ASCII representation of the bytes or '.' if they are not valid bytes.
| Modifier and Type | Field and Description |
|---|---|
protected java.io.PrintStream |
pStream
Stream that understands "printing"
|
| Constructor and Description |
|---|
HexDumpEncoder() |
| Modifier and Type | Method and Description |
|---|---|
protected int |
bytesPerAtom() |
protected int |
bytesPerLine() |
java.lang.String |
encode(byte[] aBuffer)
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
|
java.lang.String |
encode(java.nio.ByteBuffer aBuffer)
A 'streamless' version of encode that simply takes a ByteBuffer
and returns a string containing the encoded buffer.
|
void |
encode(java.io.InputStream inStream,
java.io.OutputStream outStream)
Encode bytes from the input stream, and write them as text characters
to the output stream.
|
protected void |
encodeAtom(java.io.OutputStream o,
byte[] buf,
int off,
int len) |
java.lang.String |
encodeBuffer(byte[] aBuffer)
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
|
void |
encodeBuffer(byte[] aBuffer,
java.io.OutputStream aStream)
Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
|
void |
encodeBuffer(java.nio.ByteBuffer aBuffer,
java.io.OutputStream aStream)
Encode the aBuffer ByteBuffer and write the encoded
result to the OutputStream aStream.
|
void |
encodeBuffer(java.io.InputStream inStream,
java.io.OutputStream outStream)
Encode bytes from the input stream, and write them as text characters
to the output stream.
|
protected void |
encodeBufferPrefix(java.io.OutputStream o) |
protected void |
encodeLinePrefix(java.io.OutputStream o,
int len) |
protected void |
encodeLineSuffix(java.io.OutputStream o) |
protected int |
readFully(java.io.InputStream in,
byte[] buffer)
This method works around the bizarre semantics of BufferedInputStream's
read method.
|
protected int bytesPerAtom()
protected int bytesPerLine()
protected void encodeBufferPrefix(java.io.OutputStream o)
protected void encodeLinePrefix(java.io.OutputStream o,
int len)
protected void encodeAtom(java.io.OutputStream o,
byte[] buf,
int off,
int len)
protected void encodeLineSuffix(java.io.OutputStream o)
protected int readFully(java.io.InputStream in,
byte[] buffer)
throws java.io.IOException
java.io.IOExceptionpublic void encode(java.io.InputStream inStream,
java.io.OutputStream outStream)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String encode(byte[] aBuffer)
public java.lang.String encode(java.nio.ByteBuffer aBuffer)
The ByteBuffer's position will be advanced to ByteBuffer's limit.
public void encodeBuffer(java.io.InputStream inStream,
java.io.OutputStream outStream)
throws java.io.IOException
java.io.IOExceptionpublic void encodeBuffer(byte[] aBuffer,
java.io.OutputStream aStream)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String encodeBuffer(byte[] aBuffer)
public void encodeBuffer(java.nio.ByteBuffer aBuffer,
java.io.OutputStream aStream)
throws java.io.IOException
The ByteBuffer's position will be advanced to ByteBuffer's limit.
java.io.IOException