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 byte[] |
decodeBase64Array(byte[] srcArray)
Translates the specified Base64 array into byte array.
|
static byte[] |
encodeBase64Array(byte[] srcArray)
Translates the specified byte array to Base64 byte array.
|
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 boolean |
isLetter(char c)
Determine if a specified character is a letter.
|
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 double |
pow(int base,
int exponent)
Raises an integer base to an integer power and returns the result as a
double.
|
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[] |
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 java.lang.String |
TBCDToString(byte[] bcd)
Translates a TBCD string to an ASCII string.
|
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 java.lang.String stripWhitespace(java.lang.String value)
value
- public static java.lang.String toHexString(byte b)
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 byte[] encodeBase64Array(byte[] srcArray)
srcArray
- byte array to be translatedpublic static byte[] decodeBase64Array(byte[] 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 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 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.