| Type Params | Return Type | Name and description |
|---|---|---|
|
static void |
hexdump(byte[] self, Writer writer, int idx, int len)Generate a hex-dump of a byte array. |
|
static void |
hexdump(byte[] self, int idx, int len)Generate a hex-dump of a byte array. |
|
static void |
hexdump(byte[] self, Writer writer, int idx)Generate a hex-dump of a byte array. |
|
static void |
hexdump(byte[] self, int idx)Generate a hex-dump of a byte array. |
|
static void |
hexdump(byte[] self, Writer writer)Generate a hex-dump of a byte array. |
|
static void |
hexdump(byte[] self)Generate a hex-dump of a byte array. |
Generate a hex-dump of a byte array.
byte[] bytes = "Hello and welcome to ★ Groovy".getBytes('UTF-8')
String output = new StringWriter().with { w ->
bytes.hexdump( w )
w.toString()
}
String expected = ''' +--------------------------------------------------+
| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |
| +----------+--------------------------------------------------+------------------+
| | 00000000 | 48 65 6c 6c 6f 20 61 6e 64 20 77 65 6c 63 6f 6d | Hello and welcom |
| | 00000010 | 65 20 74 6f 20 e2 98 85 20 47 72 6f 6f 76 79 | e to ... Groovy |
| +----------+--------------------------------------------------+------------------+
|'''.stripMargin()
assert output == expected
self - the byte[] to dumpwriter - the writer to dump toidx - the index into self to start dumping fromlen - the number of bytes to dumpGenerate a hex-dump of a byte array.
self - the byte[] to dumpidx - the index into self to start dumping fromlen - the number of bytes to dumpGenerate a hex-dump of a byte array.
self - the byte[] to dumpwriter - the writer to dump toidx - the index into self to start dumping fromGenerate a hex-dump of a byte array.
self - the byte[] to dumpidx - the index into self to start dumping fromGenerate a hex-dump of a byte array.
self - the byte[] to dumpwriter - the writer to dump toGenerate a hex-dump of a byte array.
self - the byte[] to dump