org.homeunix.thecave.moss.util
Class ByteFunctions

java.lang.Object
  extended by org.homeunix.thecave.moss.util.ByteFunctions

public class ByteFunctions
extends java.lang.Object


Constructor Summary
ByteFunctions()
           
 
Method Summary
static java.lang.String byteToHexString(byte[] bytes)
          Converts the given byte array to a string representation of the byte array, encoded as hex digits.
static long byteToLong(byte[] b)
          Returns a long from a byte array representation.
static byte[] hexStringToByte(java.lang.String string)
          Converts the given string representation of the hex byte array as a byte array.
static byte[] longToByte(long l)
          Returns a byte array representation of a long value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteFunctions

public ByteFunctions()
Method Detail

longToByte

public static byte[] longToByte(long l)
Returns a byte array representation of a long value. The returned byte array will be exactly 8 bytes (64 bits) long.

Parameters:
l -
Returns:

byteToLong

public static long byteToLong(byte[] b)
Returns a long from a byte array representation. The given byte array must be exactly 8 bytes (64 bits) in length; if it more or less, we return 0.

Parameters:
b -
Returns:

byteToHexString

public static java.lang.String byteToHexString(byte[] bytes)
Converts the given byte array to a string representation of the byte array, encoded as hex digits.

Parameters:
bytes -
Returns:

hexStringToByte

public static byte[] hexStringToByte(java.lang.String string)
Converts the given string representation of the hex byte array as a byte array.

Parameters:
string -
Returns: