public class DumpBytes extends Object
Hexadecimal:
68 65 6c 6c 6f 77 6f 72 6c 64 helloworld
Decimal:
104 101 108 108 111 119 111 114 hellowor 108 100 ld
Octal:
150 145 154 154 157 167 hellow 157 162 154 144 orld
Binary:
1101000 1100101 1101100 1101100 1101111 hello 1110111 1101111 1110010 1101100 1100100 world
| Modifier and Type | Field and Description |
|---|---|
static int |
BASE_BIN
Binary base (2).
|
static int |
BASE_DEC
Decimal base (10).
|
static int |
BASE_HEX
Hexadecimal base (16).
|
static int |
BASE_OCT
Octal base (8).
|
| Constructor and Description |
|---|
DumpBytes() |
| Modifier and Type | Method and Description |
|---|---|
static String |
dumpBinData(byte[] data)
Converts the given byte array to binary format.
|
static String |
dumpBinData(File f)
Converts the contents of the given File to binary format.
|
static String |
dumpBinData(String data)
Converts the given String to binary format.
|
static String |
dumpData(byte[] bytes,
int cols,
int format)
Converts the given byte array to a numerical format representation.
|
static String |
dumpData(File file,
int cols,
int format)
Reads the given File and converts its contents to a numerical format representation.
|
static String |
dumpData(String data,
int cols,
int format)
Converts the given String to a numerical format representation.
|
static String |
dumpDecData(byte[] data)
Converts the given byte array to decimal format.
|
static String |
dumpDecData(File f)
Converts the contents of the given File to decimal format.
|
static String |
dumpDecData(String data)
Converts the given String to decimal format.
|
static String |
dumpHexData(byte[] data)
Converts the given byte array to hexadecimal format.
|
static String |
dumpHexData(File f)
Converts the contents of the given File to hexadecimal format.
|
static String |
dumpHexData(String data)
Converts the given String to hexadecimal format.
|
static String |
dumpOctData(byte[] data)
Converts the given byte array to octal format.
|
static String |
dumpOctData(File f)
Converts the contents of the given File to octal format.
|
static String |
dumpOctData(String data)
Converts the given String to octal format.
|
public static final int BASE_HEX
public static final int BASE_DEC
public static final int BASE_OCT
public static final int BASE_BIN
public static String dumpData(byte[] bytes, int cols, int format)
bytes - data to be converted to a particular numerical formatcols - number of columns the output data will haveformat - numerical base the output will be shown as - e.g. BASE_HEX is hexIllegalArgumentException - if format is invalidpublic static String dumpData(String data, int cols, int format)
data - String to be converted to a particular numerical formatcols - number of columns the output data will haveformat - numerical base the output will be shown as (e.g. 16 is hex)public static String dumpData(File file, int cols, int format)
file - File whose contents are to be converted to a particular numerical formatcols - number of columns the output data will haveformat - numerical base the output will be shown as (e.g. 16 is hex)public static String dumpBinData(File f)
f - file whose contents is to be convertedpublic static String dumpBinData(byte[] data)
data - byte array to be convertedpublic static String dumpBinData(String data)
data - String to be convertedpublic static String dumpOctData(File f)
f - file whose contents is to be convertedpublic static String dumpOctData(byte[] data)
data - byte array to be convertedpublic static String dumpOctData(String data)
data - String to be convertedpublic static String dumpDecData(File f)
f - file whose contents is to be convertedpublic static String dumpDecData(byte[] data)
data - byte array to be convertedpublic static String dumpDecData(String data)
data - String to be convertedpublic static String dumpHexData(File f)
f - file whose contents is to be convertedpublic static String dumpHexData(byte[] data)
data - byte array to be convertedCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.