|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.vt.middleware.crypt.util.AbstractEncodingConverter
edu.vt.middleware.crypt.util.HexConverter
public class HexConverter
Converts bytes to HEX and vice versa.
| Field Summary | |
|---|---|
static String |
DEFAULT_BYTE_DELIMITER
Default byte delimiter. |
| Constructor Summary | |
|---|---|
HexConverter()
Creates a new instance. |
|
HexConverter(boolean delimitBytes)
Creates a new instance that optionally handled delimited bytes in the string input/output. |
|
| Method Summary | |
|---|---|
String |
fromBytes(byte[] input,
int offset,
int length)
Converts a byte array to a formatted/encoded string. |
String |
getByteDelimiter()
Gets the byte delmiter string. |
protected org.bouncycastle.util.encoders.Encoder |
getEncoder()
Gets the encoder instance that does the work of byte-char/char-byte encoding. |
void |
setByteDelimiter(String delim)
Sets the byte delimiter string. |
byte[] |
toBytes(String input)
Converts a formatted/encoded string to raw bytes. |
| Methods inherited from class edu.vt.middleware.crypt.util.AbstractEncodingConverter |
|---|
fromBytes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_BYTE_DELIMITER
| Constructor Detail |
|---|
public HexConverter()
public HexConverter(boolean delimitBytes)
delimitBytes - True to handle delimited input and produce delimited
output strings with delimiter character, false otherwise. If enabled, the
input/output hexadecimal strings would resemble 1A:2B:3C:4D.
Call setByteDelimiter(String) to use a delimiter other than DEFAULT_BYTE_DELIMITER.
Note: Setting delimited output has the side effect of producing uppercase hex characters. This is because several cryptographic utilities produce delimited fingerprints with uppercase hex characters, so delimited output keeps with that convention since it is anticipated to be the common use case for this feature.
| Method Detail |
|---|
public String getByteDelimiter()
public void setByteDelimiter(String delim)
1A:2B:3C:4D.
delim - Byte delimiter string.
public String fromBytes(byte[] input,
int offset,
int length)
fromBytes in interface ConverterfromBytes in class AbstractEncodingConverterinput - Input bytes.offset - Offset into input bytes at which to begin processing.length - Number of bytes of input data to process.
public byte[] toBytes(String input)
toBytes in interface ConvertertoBytes in class AbstractEncodingConverterinput - Formatted/encoded input string.
protected org.bouncycastle.util.encoders.Encoder getEncoder()
getEncoder in class AbstractEncodingConverter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||