SafeAPI v1.20

com.safeapi
Class Convert

java.lang.Object
  extended bycom.safeapi.Convert

public final class Convert
extends Object

Conversion tools and methods


Field Summary
static String CRYPTO_ON
           
 
Constructor Summary
Convert()
          Loads an instance of Convert.
 
Method Summary
 byte[] base64StringToBytes(String sBase64)
          Returns a byte array from a Base64 String.
 String bytesToBase64String(byte[] bBytes)
          Returns a Base64 String from a byte array.
 String bytesToHexString(byte[] bBytes)
          Returns a string of hexadecimal digits from a byte array.
 String bytesToString(byte[] bBytes)
          Converts a byte array to string.
 byte[] hexStringToBytes(String sHex)
          Returns a byte array from a string of hexadecimal digits.
 byte[] stringToBytes(String sString)
          Converts a string into its bytes representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRYPTO_ON

public static String CRYPTO_ON
Constructor Detail

Convert

public Convert()
Loads an instance of Convert.

Method Detail

bytesToString

public String bytesToString(byte[] bBytes)
Converts a byte array to string.

Parameters:
bBytes - bytes to convert.
Returns:
String expression of bytes.

stringToBytes

public byte[] stringToBytes(String sString)
Converts a string into its bytes representation.

Parameters:
sString - the string to convert.
Returns:
the bytes representing the string.

hexStringToBytes

public byte[] hexStringToBytes(String sHex)
Returns a byte array from a string of hexadecimal digits.

Parameters:
sHex - string of hexadecimal digits.
Returns:
byte array.

bytesToHexString

public String bytesToHexString(byte[] bBytes)
Returns a string of hexadecimal digits from a byte array. Each byte is converted to 2 hex symbols.
If offset and length are omitted, the whole array is used.


bytesToBase64String

public String bytesToBase64String(byte[] bBytes)
Returns a Base64 String from a byte array.

Parameters:
bBytes - a byte array.
Returns:
a Base64 string.

base64StringToBytes

public byte[] base64StringToBytes(String sBase64)
Returns a byte array from a Base64 String.

Parameters:
sBase64 - Base64 string.
Returns:
a byte array.

SafeAPI v1.20

Copyright © SafeLogic 2005