public class HexDumpEncoder extends 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 PrintStream |
pStream
Stream that understands "printing"
|
Constructor and Description |
---|
HexDumpEncoder() |
Modifier and Type | Method and Description |
---|---|
protected int |
bytesPerAtom() |
protected int |
bytesPerLine() |
String |
encode(byte[] aBuffer)
A 'streamless' version of encode that simply takes a buffer of
bytes and returns a string containing the encoded buffer.
|
String |
encode(ByteBuffer aBuffer)
A 'streamless' version of encode that simply takes a ByteBuffer
and returns a string containing the encoded buffer.
|
void |
encode(InputStream inStream,
OutputStream outStream)
Encode bytes from the input stream, and write them as text characters
to the output stream.
|
protected void |
encodeAtom(byte[] buf,
int off) |
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,
OutputStream aStream)
Encode the buffer in aBuffer and write the encoded
result to the OutputStream aStream.
|
void |
encodeBuffer(ByteBuffer aBuffer,
OutputStream aStream)
Encode the aBuffer ByteBuffer and write the encoded
result to the OutputStream aStream.
|
void |
encodeBuffer(InputStream inStream,
OutputStream outStream)
Encode bytes from the input stream, and write them as text characters
to the output stream.
|
protected void |
encodeBufferPrefix(OutputStream o) |
protected void |
encodeLinePrefix(int len) |
protected void |
encodeLineSuffix() |
protected int |
readFully(InputStream in,
byte[] buffer)
This method works around the bizarre semantics of BufferedInputStream's
read method.
|
protected PrintStream pStream
protected int bytesPerAtom()
protected int bytesPerLine()
protected void encodeBufferPrefix(OutputStream o)
protected void encodeLinePrefix(int len)
protected void encodeAtom(byte[] buf, int off)
protected void encodeLineSuffix()
protected int readFully(InputStream in, byte[] buffer) throws IOException
IOException
public void encode(InputStream inStream, OutputStream outStream) throws IOException
IOException
public String encode(byte[] aBuffer)
public String encode(ByteBuffer aBuffer)
The ByteBuffer's position will be advanced to ByteBuffer's limit.
public void encodeBuffer(InputStream inStream, OutputStream outStream) throws IOException
IOException
public void encodeBuffer(byte[] aBuffer, OutputStream aStream) throws IOException
IOException
public String encodeBuffer(byte[] aBuffer)
public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream) throws IOException
The ByteBuffer's position will be advanced to ByteBuffer's limit.
IOException
Copyright © 2001–2024 MickaĆ«l Guessant. All rights reserved.