public class Asn1Util
extends java.lang.Object
| Constructor and Description |
|---|
Asn1Util() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
BCDToString(byte[] bcd)
Translates a BCD string to an ASCII string.
|
static void |
closeRuntime()
Signal that you are finished with the ASN1C runtime and release internal
resources.
|
static byte[] |
decodeBase64Array(char[] srcArray)
Translates the specified Base64 array into byte array.
|
static java.lang.String |
encodeBase64Array(byte[] srcArray)
Translates the specified byte array to Base64 string.
|
static java.lang.String |
firstSortedElement(java.util.Vector v)
Returns the element of a Vector (that is assumed to contain strings) that is
lexicographically the lowest element in the Vector.
|
static int |
getBytesCount(long val)
Calculate the count of bytes necessary to represent a signed long value.
|
static java.util.Vector |
getKeys(java.util.Hashtable h)
Returns a Vector containing the keys (assumed to be strings) of a passed
Hashtable.
|
static int |
getUlongBytesCount(long val)
Calculate the count of bytes necessary to represent an unsigned long value.
|
static int |
hexToByte(char c)
Return the value of a single hexadecimal character.
|
static boolean |
isLetter(char c)
Determine if a specified character is a letter.
|
static boolean |
isLimited()
Indicates whether the run-time is limited or unlimited.
|
static boolean |
isSpaceChar(char ch)
Determine if a specified character is a space.
|
static boolean |
isWhitespace(char ch)
Determine if a specified character is whitespace.
|
static double |
log2(double val)
Calculate the log base 2 of value
|
static java.lang.String[] |
PLMNidentityToString(byte[] plmnIdentity)
Translates a PLMN identity string (i.e., byte array) to ASCII strings for the MCC and the MNC.
|
static double |
pow(int base,
int exponent)
Raises an integer base to an integer power and returns the result as a
double.
|
static int |
rotateLeft(int value,
int bitCnt)
Return the result of rotating the bits in value left by bitCnt positions.
|
static java.lang.String[] |
splitOnWhitespace(java.lang.String delimitedString)
Split a string around whitespace characters.
|
static byte[] |
stringToBCD(java.lang.String str)
Translates an ASCII string to a BCD string.
|
static byte[] |
stringToPLMNidentity(java.lang.String mcc,
java.lang.String mnc)
Translates ASCII Strings for MCC and MNC to a PLMNidentity.
|
static byte[] |
stringToTBCD(java.lang.String str)
Translates an ASCII String to a TBCD String.
|
static java.lang.String |
stripWhitespace(java.lang.String value)
Return the given string with all whitespace characters removed.
|
static char |
tbcdBinToChar(byte tbcdDigit)
This function converts a TBCD binary character into its ASCII equivalent.
|
static byte |
tbcdCharToBin(char digit)
This function converts a TBCD character ('0'-'9',"*#abc") into its binary
equivalent.
|
static java.lang.String |
TBCDToString(byte[] bcd)
Translates a TBCD string to an ASCII string.
|
static char |
toHexChar(int nibble)
Convert a value from 0x0 to 0xF to the corresponding hex char.
|
static java.lang.String |
toHexString(byte b)
Convert a byte value to a hex string.
|
static java.lang.String |
toHexString(byte[] b,
int offset,
int nbytes)
Convert a string of bytes into a hex string.
|
static java.lang.StringBuffer |
toHexString(byte b,
java.lang.StringBuffer hexbuf)
Convert a byte value to a hex string.
|
public static void closeRuntime()
public static java.lang.String stripWhitespace(java.lang.String value)
value - public static int hexToByte(char c)
c - The hex character (0-9,A-F,a-f)Asn1Exception - if charater is not a hex character.public static java.lang.String toHexString(byte b)
public static char toHexChar(int nibble)
public static java.lang.StringBuffer toHexString(byte b,
java.lang.StringBuffer hexbuf)
public static java.lang.String toHexString(byte[] b,
int offset,
int nbytes)
public static int getBytesCount(long val)
val - Integer value in which to count bytes.public static double log2(double val)
val - double value for which to count log(base2) val.public static int getUlongBytesCount(long val)
val - Integer value in which to count bytes.public static java.lang.String encodeBase64Array(byte[] srcArray)
srcArray - byte array to be translatedpublic static byte[] decodeBase64Array(char[] srcArray)
srcArray - Base64 byte array to be translatedpublic static byte[] stringToBCD(java.lang.String str)
throws Asn1ValueParseException
str - the source ASCII stringAsn1ValueParseException - If invalid characters are in the source
string.public static java.lang.String BCDToString(byte[] bcd)
bcd - the source BCD stringpublic static byte[] stringToTBCD(java.lang.String str)
throws Asn1ValueParseException
str - the source ASCII stringAsn1ValueParseException - If invalid characters are in the source
string.public static java.lang.String TBCDToString(byte[] bcd)
bcd - the source TBCD stringpublic static byte[] stringToPLMNidentity(java.lang.String mcc,
java.lang.String mnc)
throws Asn1ValueParseException
mcc - the source ASCII string for the MCC.mnc - the source ASCII string for the MNC.Asn1ValueParseException - If invalid characters are in the source
strings or they have an invalid length.public static java.lang.String[] PLMNidentityToString(byte[] plmnIdentity)
throws Asn1ValueParseException
plmnIdentity - the source PLMN identity string (byte array)Asn1ValueParseExceptionpublic static char tbcdBinToChar(byte tbcdDigit)
tbcdDigit - TBCD digit, 0..14 (0x0..0xE)public static byte tbcdCharToBin(char digit)
digit - TBCD digit character ('0'-'9',"*#abc")public static boolean isLimited()
public static double pow(int base,
int exponent)
base - the base to be raised to the power.exponent - the power to which base is to be raised.public static int rotateLeft(int value,
int bitCnt)
value - bitCnt - public static boolean isWhitespace(char ch)
ch - the character to test.public static boolean isSpaceChar(char ch)
ch - the character to test.public static java.lang.String firstSortedElement(java.util.Vector v)
v - the Vector to be examined.public static java.util.Vector getKeys(java.util.Hashtable h)
h - the Hashtable to be examined.public static boolean isLetter(char c)
c - The character to examine.public static java.lang.String[] splitOnWhitespace(java.lang.String delimitedString)
delimitedString - the whitespace-delimited string to parse.