|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.prosyst.util.encode.Hex
public final class Hex
This class encodes a binary data into a HEX representation string. The encoded string contains each byte of the binary data, represented by its hexa-decimal value, and separated by dash (-) symbol. As example, the Java byte array:
0, 15, 33encodes as
0-f-21
| Constructor Summary | |
|---|---|
Hex()
|
|
| Method Summary | |
|---|---|
static byte[] |
decode(java.lang.String input)
Decodes HEX form a String. |
static java.lang.String |
encode(byte[] data)
Encodes byte[] into HEX. |
static java.lang.String |
encode(byte[] data,
int start,
int length)
Encodes the a portion of a given binary data into a HEX string |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Hex()
| Method Detail |
|---|
public static final java.lang.String encode(byte[] data)
byte[] into HEX.
data - byte[]
String which contains encoded in HEX bytes If
byte[] is with length 0 returns an empty
String
public static final java.lang.String encode(byte[] data,
int start,
int length)
data - the binary data, that will be encodedstart - the start index, from which the data will be readlength - the number of elements to be extracted from the byte array
public static final byte[] decode(java.lang.String input)
throws java.lang.Exception
String. The new line (\n) and carriage
return (\r) symbols in the string are ignored.
input - the HEX encoded string, that will be decoded
java.lang.Exception
java.lang.Exception - if illegal hex block is detected (e.g. the number of
symbols is more than 2), if illegal character is detected in the
encoded string - a one, that is not a hex digit, dash (-), new
line (\n) or carriage return (\r).
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||