Hex encoder and decoder. More...
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
byte[] | decode (byte[] array) throws DecoderException |
Converts an array of character bytes representing hexidecimal values into an array of bytes of those same values. More... | |
Object | decode (Object object) throws DecoderException |
Converts a String or an array of character bytes representing hexidecimal values into an array of bytes of those same values. More... | |
byte[] | encode (byte[] array) |
Converts an array of bytes into an array of bytes for the characters representing the hexidecimal values of each byte in order. More... | |
Object | encode (Object object) throws EncoderException |
Converts a String or an array of bytes into an array of characters representing the hexidecimal values of each byte in order. More... | |
Static Public Member Functions | |
static byte[] | decodeHex (char[] data) throws DecoderException |
Converts an array of characters representing hexidecimal values into an array of bytes of those same values. More... | |
static char[] | encodeHex (byte[] data) |
Converts an array of bytes into an array of characters representing the hexidecimal values of each byte in order. More... | |
Static Protected Member Functions | |
static int | toDigit (char ch, int index) throws DecoderException |
Converts a hexadecimal character to an integer. More... | |
|
static |
The returned array will be half the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
data | An array of characters containing hexidecimal digits |
DecoderException | Thrown if an odd number or illegal of characters is supplied |
|
staticprotected |
ch | A character to convert to an integer digit |
index | The index of the character in the source |
DecoderException | Thrown if ch is an illegal hex character |
|
static |
The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
data | a byte[] to convert to Hex characters |
byte [] decode | ( | byte[] | array | ) | throws DecoderException |
The returned array will be half the length of the passed array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
array | An array of character bytes containing hexidecimal digits |
DecoderException | Thrown if an odd number of characters is supplied to this function |
Implements BinaryDecoder.
Object decode | ( | Object | object | ) | throws DecoderException |
The returned array will be half the length of the passed String or array, as it takes two characters to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
object | A String or, an array of character bytes containing hexidecimal digits |
DecoderException | Thrown if an odd number of characters is supplied to this function or the object is not a String or char[] |
Implements Decoder.
byte [] encode | ( | byte[] | array | ) |
The returned array will be double the length of the passed array, as it takes two characters to represent any given byte.
array | a byte[] to convert to Hex characters |
Implements BinaryEncoder.
Object encode | ( | Object | object | ) | throws EncoderException |
The returned array will be double the length of the passed String or array, as it takes two characters to represent any given byte.
object | a String, or byte[] to convert to Hex characters |
EncoderException | Thrown if the given object is not a String or byte[] |
Implements Encoder.