iaik.tc.utils.misc
Class Utils

java.lang.Object
  extended by iaik.tc.utils.misc.Utils

public class Utils
extends java.lang.Object

This class contains a collection of helper methods.


Field Summary
static java.lang.String lineSeperator
           
 
Method Summary
static byte booleanToByte(boolean value)
          This method converts a Java boolean into a byte representation.
static java.lang.String booleanToString(boolean value)
          This method returns a String representation (i.e.
static java.lang.String byteArrayToHexString(byte[] data)
          This method returns a Hex-String of the provided byte array.
static java.lang.String byteArrayToHexString(byte[] data, java.lang.String delimiter, int octetsPerLine)
          This method returns a Hex-String of the provided byte array.
static short[] byteArrayToShortArray(byte[] input)
          This method converts a byte array into a short array.
static boolean byteToBoolean(byte value)
          This method converts a byte representation of a boolean value into the Java boolean type
static java.lang.String getFSep()
          This method returns the platform specific character sequence for "new line".
static java.lang.String getNL()
          This method returns the platform specific character sequence for "new line".
static byte[] hexStringToByteArray(java.lang.String data)
          This method converts the given hex string into a byte array.
static short[] hexStringToShortArray(java.lang.String data)
          This method converts the given hex string into a short array.
static boolean longToBoolean(long value)
          This method converts a short representation of a boolean value into the Java boolean type.
static java.lang.String longToHex(long value)
          This method converts a long into an Hex-String of the form 0x1234.
static java.lang.String longToHexNoPrefix(long value)
          This method converts a long into a Hex-String without leading 0x.
static byte[] shortArrayToByteArray(short[] input)
          This method returns a byte array of the provided short array.
static java.lang.String shortArrayToHexString(short[] data)
          This method returns a Hex-String of the provided short array.
static boolean shortToBoolean(short value)
          This method converts a short representation of a boolean value into the Java boolean type.
static short unsignedByteToShort(byte b)
          This method converts an unsigned byte value into a short value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSeperator

public static final java.lang.String lineSeperator
Method Detail

byteToBoolean

public static boolean byteToBoolean(byte value)
This method converts a byte representation of a boolean value into the Java boolean type


shortToBoolean

public static boolean shortToBoolean(short value)
This method converts a short representation of a boolean value into the Java boolean type.


longToBoolean

public static boolean longToBoolean(long value)
This method converts a short representation of a boolean value into the Java boolean type.


booleanToByte

public static byte booleanToByte(boolean value)
This method converts a Java boolean into a byte representation.


booleanToString

public static java.lang.String booleanToString(boolean value)
This method returns a String representation (i.e. "true" or "false") of the given boolean value.


longToHex

public static java.lang.String longToHex(long value)
This method converts a long into an Hex-String of the form 0x1234.


longToHexNoPrefix

public static java.lang.String longToHexNoPrefix(long value)
This method converts a long into a Hex-String without leading 0x.


getNL

public static java.lang.String getNL()
This method returns the platform specific character sequence for "new line".


getFSep

public static java.lang.String getFSep()
This method returns the platform specific character sequence for "new line".


unsignedByteToShort

public static short unsignedByteToShort(byte b)
This method converts an unsigned byte value into a short value. Note: The provided byte value is interpreted as unsigned although the byte type of java is signed.


byteArrayToShortArray

public static short[] byteArrayToShortArray(byte[] input)
This method converts a byte array into a short array.


byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] data)
This method returns a Hex-String of the provided byte array.


byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] data,
                                                    java.lang.String delimiter,
                                                    int octetsPerLine)
This method returns a Hex-String of the provided byte array.


hexStringToByteArray

public static byte[] hexStringToByteArray(java.lang.String data)
This method converts the given hex string into a byte array. It is the opposite the the byteArrayToHexString method.


shortArrayToHexString

public static java.lang.String shortArrayToHexString(short[] data)
This method returns a Hex-String of the provided short array.


hexStringToShortArray

public static short[] hexStringToShortArray(java.lang.String data)
This method converts the given hex string into a short array. It is the opposite the the shortArrayToHexString method.


shortArrayToByteArray

public static byte[] shortArrayToByteArray(short[] input)
This method returns a byte array of the provided short array. The values contained in the short array must not be outside the 0 to 255 range.