org.apache.poi.contrib.poibrowser
public class Codec extends java.lang.Object
Provides utility methods for encoding and decoding hexadecimal data.
Modifier and Type | Field and Description |
---|---|
protected static byte[] |
hexval
The nibbles' hexadecimal values.
|
Constructor and Description |
---|
Codec() |
Modifier and Type | Method and Description |
---|---|
protected static byte |
decodeNibble(char c)
Decodes a nibble.
|
static byte[] |
hexDecode(java.lang.String s)
Decodes the hexadecimal representation of a sequence of
bytes into a byte array.
|
static java.lang.String |
hexEncode(byte b)
Converts a single byte into its hexadecimal notation.
|
static java.lang.String |
hexEncode(byte[] s)
Converts a byte array into its hexadecimal notation.
|
static java.lang.String |
hexEncode(byte[] s,
int offset,
int length)
Converts a part of a byte array into its hexadecimal
notation.
|
static java.lang.String |
hexEncode(ClassID classID)
Converts a class ID into its hexadecimal notation.
|
static java.lang.String |
hexEncode(int i)
Converts an int value (32-bit) into its hexadecimal
notation.
|
static java.lang.String |
hexEncode(long l)
Converts a long value (64-bit) into its hexadecimal
notation.
|
static java.lang.String |
hexEncode(short s)
Converts a short value (16-bit) into its hexadecimal
notation.
|
static java.lang.String |
hexEncode(java.lang.String s)
Converts a string into its hexadecimal notation.
|
static void |
main(java.lang.String[] args)
For testing.
|
protected static final byte[] hexval
The nibbles' hexadecimal values. A nibble is a half byte.
public static java.lang.String hexEncode(java.lang.String s)
Converts a string into its hexadecimal notation.
public static java.lang.String hexEncode(byte[] s)
Converts a byte array into its hexadecimal notation.
public static java.lang.String hexEncode(byte[] s, int offset, int length)
Converts a part of a byte array into its hexadecimal notation.
public static java.lang.String hexEncode(byte b)
Converts a single byte into its hexadecimal notation.
public static java.lang.String hexEncode(short s)
Converts a short value (16-bit) into its hexadecimal notation.
public static java.lang.String hexEncode(int i)
Converts an int value (32-bit) into its hexadecimal notation.
public static java.lang.String hexEncode(long l)
Converts a long value (64-bit) into its hexadecimal notation.
public static java.lang.String hexEncode(ClassID classID)
Converts a class ID into its hexadecimal notation.
public static byte[] hexDecode(java.lang.String s)
Decodes the hexadecimal representation of a sequence of bytes into a byte array. Each character in the string represents a nibble (half byte) and must be one of the characters '0'-'9', 'A'-'F' or 'a'-'f'.
s
- The string to be decodedjava.lang.IllegalArgumentException
- if the string does not contain
a valid representation of a byte sequence.protected static byte decodeNibble(char c)
Decodes a nibble.
c
- A character in the range '0'-'9' or 'A'-'F'. Lower
case is not supported here.java.lang.IllegalArgumentException
- if c is not a
permitted characterpublic static void main(java.lang.String[] args) throws java.io.IOException
For testing.
java.io.IOException
Copyright 2014 The Apache Software Foundation or its licensors, as applicable.