jdbm.helper

## Class Conversion

- java.lang.Object
- - jdbm.helper.Conversion

    public class Conversion
    extends Object

Miscelaneous conversion utility methods.

Author:
  Alex Boisvert

### Constructor Summary

Constructors
Constructor and Description
`Conversion()`

### Method Summary

Methods
`static byte[]` `convertToByteArray(byte n)` Convert a byte into a byte array.
`static byte[]` `convertToByteArray(int n)` Convert an int into a byte array.
`static byte[]` `convertToByteArray(long n)` Convert a long into a byte array.
`static byte[]` `convertToByteArray(short n)` Convert a short into a byte array.
`static byte[]` `convertToByteArray(String s)` Convert a string into a byte array.
`static int` `convertToInt(byte[] buf)` Convert a byte array into an integer (signed 32-bit) value.
`static long` `convertToLong(byte[] buf)` Convert a byte array into a long (signed 64-bit) value.
`static String` `convertToString(byte[] buf)` Convert a byte array (encoded as UTF-8) into a String
`static void` `main(String[] args)` Test static methods

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Conversion

    public Conversion()

### Method Detail

#### convertToByteArray

    public static byte[] convertToByteArray(String s)

Convert a string into a byte array.

#### convertToByteArray

    public static byte[] convertToByteArray(byte n)

Convert a byte into a byte array.

#### convertToByteArray

    public static byte[] convertToByteArray(short n)

Convert a short into a byte array.

#### convertToByteArray

    public static byte[] convertToByteArray(int n)

Convert an int into a byte array.

#### convertToByteArray

    public static byte[] convertToByteArray(long n)

Convert a long into a byte array.

#### convertToString

    public static String convertToString(byte[] buf)

Convert a byte array (encoded as UTF-8) into a String

#### convertToInt

    public static int convertToInt(byte[] buf)

Convert a byte array into an integer (signed 32-bit) value.

#### convertToLong

    public static long convertToLong(byte[] buf)

Convert a byte array into a long (signed 64-bit) value.

#### main

    public static void main(String[] args)

Test static methods