edu.stanford.nlp.maxent
Class Convert

java.lang.Object
  extended by edu.stanford.nlp.maxent.Convert

public final class Convert
extends java.lang.Object

This is used to convert an array of double into byte array which makes it possible to keep it more efficiently.


Field Summary
static java.lang.String codeTable
           
 
Method Summary
static char asciiToChar(byte b)
           
static java.lang.String asciiToNative(byte[] b)
           
static java.lang.String asciiToNative(byte[] b, int off, int i)
           
static void aStringArrToByteArr(byte[] b, int pos, java.lang.String[] s, int off, int length)
           
static byte[] aStringArrToByteArr(java.lang.String[] s)
           
static byte[] aStringArrToByteArr(java.lang.String[] s, int off, int length)
           
static byte[] booleanArrToByteArr(boolean[] b)
           
static byte[] booleanArrToByteArr(boolean[] b, int off, int len)
           
static void booleanArrToByteArr(byte[] bytes, int pos, boolean[] b, int off, int length)
           
static java.lang.String byteArrToAString(byte[] b)
           
static java.lang.String byteArrToAString(byte[] b, int off, int length)
           
static java.lang.String[] byteArrToAStringArr(byte[] b)
           
static java.lang.String[] byteArrToAStringArr(byte[] b, int off, int length)
           
static void byteArrToAStringArr(byte[] b, int off, java.lang.String[] s, int pos, int length)
           
static boolean byteArrToBoolean(byte[] b, int off)
           
static boolean[] byteArrToBooleanArr(byte[] b)
           
static void byteArrToBooleanArr(byte[] b, int off, boolean[] bool, int pos, int length)
           
static boolean[] byteArrToBooleanArr(byte[] b, int off, int length)
           
static char byteArrToChar(byte[] b, int off)
           
static char[] byteArrToCharArr(byte[] b)
           
static void byteArrToCharArr(byte[] b, int off, char[] c, int pos, int length)
           
static char[] byteArrToCharArr(byte[] b, int off, int length)
           
static double byteArrToDouble(byte[] b, int off)
           
static double[] byteArrToDoubleArr(byte[] b)
          This method allocates a new double[] to return, based on the size of the array b (namely b.length / 8 in size)
static void byteArrToDoubleArr(byte[] b, int off, double[] d, int pos, int length)
           
static double[] byteArrToDoubleArr(byte[] b, int off, int length)
           
static float byteArrToFloat(byte[] b, int off)
           
static float[] byteArrToFloatArr(byte[] b)
           
static void byteArrToFloatArr(byte[] b, int off, float[] f, int pos, int length)
           
static float[] byteArrToFloatArr(byte[] b, int off, int length)
           
static int byteArrToInt(byte[] b, int off)
           
static int[] byteArrToIntArr(byte[] b)
           
static int[] byteArrToIntArr(byte[] b, int off, int length)
           
static void byteArrToIntArr(byte[] b, int off, int[] i, int pos, int length)
           
static long byteArrToLong(byte[] b, int off)
           
static long[] byteArrToLongArr(byte[] b)
           
static long[] byteArrToLongArr(byte[] b, int off, int length)
           
static void byteArrToLongArr(byte[] b, int off, long[] l, int pos, int length)
           
static short byteArrToShort(byte[] b, int off)
           
static short[] byteArrToShortArr(byte[] b)
           
static short[] byteArrToShortArr(byte[] b, int off, int length)
           
static void byteArrToShortArr(byte[] b, int off, short[] s, int pos, int length)
           
static java.lang.String byteArrToUString(byte[] b)
           
static java.lang.String byteArrToUString(byte[] b, int off, int strLen)
           
static java.lang.String[] byteArrToUStringArr(byte[] b)
           
static java.lang.String[] byteArrToUStringArr(byte[] b, int off, int length)
           
static void byteArrToUStringArr(byte[] b, int off, java.lang.String[] s, int pos, int length)
           
static void charArrToByteArr(byte[] b, int pos, char[] c, int off, int len)
           
static byte[] charArrToByteArr(char[] c)
           
static byte[] charArrToByteArr(char[] c, int off, int len)
           
static byte charToAscii(char c)
           
static void doubleArrToByteArr(byte[] b, int pos, double[] d, int off, int length)
           
static byte[] doubleArrToByteArr(double[] d)
           
static byte[] doubleArrToByteArr(double[] d, int off, int length)
           
static void floatArrToByteArr(byte[] b, int pos, float[] f, int off, int len)
           
static byte[] floatArrToByteArr(float[] f)
           
static byte[] floatArrToByteArr(float[] f, int off, int length)
           
static java.lang.String getEncoding()
           
static void intArrToByteArr(byte[] b, int pos, int[] i, int off, int len)
           
static byte[] intArrToByteArr(int[] i)
           
static byte[] intArrToByteArr(int[] i, int off, int length)
           
static void longArrToByteArr(byte[] b, int pos, long[] l, int off, int length)
           
static byte[] longArrToByteArr(long[] l)
           
static byte[] longArrToByteArr(long[] l, int off, int length)
           
static void main(java.lang.String[] str)
           
static byte[] nativeToAscii(java.lang.String s)
           
static double[] readDoubleArr(java.io.DataInputStream rf)
           
static float[] readFloatArr(java.io.DataInputStream rf)
           
static void saveDoubleArr(java.io.DataOutputStream rf, double[] arr)
           
static void saveFloatArr(java.io.DataOutputStream rf, float[] arr)
           
static void shortArrToByteArr(byte[] b, int pos, short[] s, int off, int len)
           
static byte[] shortArrToByteArr(short[] s)
           
static byte[] shortArrToByteArr(short[] s, int off, int length)
           
static byte[] stringAToByteArr(java.lang.String s)
           
static byte[] stringUToByteArr(java.lang.String s)
           
static void uStringArrToByteArr(byte[] b, int pos, java.lang.String[] s, int off, int length)
           
static byte[] uStringArrToByteArr(java.lang.String[] s)
           
static byte[] uStringArrToByteArr(java.lang.String[] s, int off, int length)
           
static void writeAStringToByteArr(byte[] b, int off, java.lang.String s)
           
static void writeAStringToByteArr(byte[] b, int off, java.lang.String s, int pos, int length)
           
static void writeBooleanToByteArr(byte[] b, int off, boolean bool)
           
static void writeCharToByteArr(byte[] b, int off, char c)
           
static void writeDoubleToByteArr(byte[] b, int off, double d)
           
static void writeFloatToByteArr(byte[] b, int off, float f)
           
static void writeIntToByteArr(byte[] b, int off, int i)
           
static void writeLongToByteArr(byte[] b, int off, long l)
           
static void writeShortToByteArr(byte[] b, int off, short s)
           
static void writeUStringToByteArr(byte[] b, int off, java.lang.String s)
           
static void writeUStringToByteArr(byte[] b, int off, java.lang.String s, int pos, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

codeTable

public static final java.lang.String codeTable
See Also:
Constant Field Values
Method Detail

main

public static void main(java.lang.String[] str)

getEncoding

public static java.lang.String getEncoding()

nativeToAscii

public static byte[] nativeToAscii(java.lang.String s)

asciiToNative

public static java.lang.String asciiToNative(byte[] b)

asciiToNative

public static java.lang.String asciiToNative(byte[] b,
                                             int off,
                                             int i)

charToAscii

public static byte charToAscii(char c)

asciiToChar

public static char asciiToChar(byte b)

writeIntToByteArr

public static void writeIntToByteArr(byte[] b,
                                     int off,
                                     int i)

writeLongToByteArr

public static void writeLongToByteArr(byte[] b,
                                      int off,
                                      long l)

writeFloatToByteArr

public static void writeFloatToByteArr(byte[] b,
                                       int off,
                                       float f)

writeDoubleToByteArr

public static void writeDoubleToByteArr(byte[] b,
                                        int off,
                                        double d)

writeBooleanToByteArr

public static void writeBooleanToByteArr(byte[] b,
                                         int off,
                                         boolean bool)

writeCharToByteArr

public static void writeCharToByteArr(byte[] b,
                                      int off,
                                      char c)

writeShortToByteArr

public static void writeShortToByteArr(byte[] b,
                                       int off,
                                       short s)

writeUStringToByteArr

public static void writeUStringToByteArr(byte[] b,
                                         int off,
                                         java.lang.String s)

writeUStringToByteArr

public static void writeUStringToByteArr(byte[] b,
                                         int off,
                                         java.lang.String s,
                                         int pos,
                                         int length)

writeAStringToByteArr

public static void writeAStringToByteArr(byte[] b,
                                         int off,
                                         java.lang.String s)

writeAStringToByteArr

public static void writeAStringToByteArr(byte[] b,
                                         int off,
                                         java.lang.String s,
                                         int pos,
                                         int length)

byteArrToInt

public static int byteArrToInt(byte[] b,
                               int off)

byteArrToShort

public static short byteArrToShort(byte[] b,
                                   int off)

byteArrToFloat

public static float byteArrToFloat(byte[] b,
                                   int off)

byteArrToDouble

public static double byteArrToDouble(byte[] b,
                                     int off)

byteArrToLong

public static long byteArrToLong(byte[] b,
                                 int off)

byteArrToBoolean

public static boolean byteArrToBoolean(byte[] b,
                                       int off)

byteArrToChar

public static char byteArrToChar(byte[] b,
                                 int off)

byteArrToUString

public static java.lang.String byteArrToUString(byte[] b)

byteArrToUString

public static java.lang.String byteArrToUString(byte[] b,
                                                int off,
                                                int strLen)

byteArrToAString

public static java.lang.String byteArrToAString(byte[] b)

byteArrToAString

public static java.lang.String byteArrToAString(byte[] b,
                                                int off,
                                                int length)

stringUToByteArr

public static byte[] stringUToByteArr(java.lang.String s)

stringAToByteArr

public static byte[] stringAToByteArr(java.lang.String s)

intArrToByteArr

public static byte[] intArrToByteArr(int[] i)

intArrToByteArr

public static byte[] intArrToByteArr(int[] i,
                                     int off,
                                     int length)

intArrToByteArr

public static void intArrToByteArr(byte[] b,
                                   int pos,
                                   int[] i,
                                   int off,
                                   int len)

longArrToByteArr

public static byte[] longArrToByteArr(long[] l)

longArrToByteArr

public static byte[] longArrToByteArr(long[] l,
                                      int off,
                                      int length)

longArrToByteArr

public static void longArrToByteArr(byte[] b,
                                    int pos,
                                    long[] l,
                                    int off,
                                    int length)

booleanArrToByteArr

public static byte[] booleanArrToByteArr(boolean[] b)

booleanArrToByteArr

public static byte[] booleanArrToByteArr(boolean[] b,
                                         int off,
                                         int len)

booleanArrToByteArr

public static void booleanArrToByteArr(byte[] bytes,
                                       int pos,
                                       boolean[] b,
                                       int off,
                                       int length)

charArrToByteArr

public static byte[] charArrToByteArr(char[] c)

charArrToByteArr

public static byte[] charArrToByteArr(char[] c,
                                      int off,
                                      int len)

charArrToByteArr

public static void charArrToByteArr(byte[] b,
                                    int pos,
                                    char[] c,
                                    int off,
                                    int len)

floatArrToByteArr

public static byte[] floatArrToByteArr(float[] f)

floatArrToByteArr

public static byte[] floatArrToByteArr(float[] f,
                                       int off,
                                       int length)

floatArrToByteArr

public static void floatArrToByteArr(byte[] b,
                                     int pos,
                                     float[] f,
                                     int off,
                                     int len)

doubleArrToByteArr

public static byte[] doubleArrToByteArr(double[] d)

doubleArrToByteArr

public static byte[] doubleArrToByteArr(double[] d,
                                        int off,
                                        int length)

doubleArrToByteArr

public static void doubleArrToByteArr(byte[] b,
                                      int pos,
                                      double[] d,
                                      int off,
                                      int length)

shortArrToByteArr

public static byte[] shortArrToByteArr(short[] s)

shortArrToByteArr

public static byte[] shortArrToByteArr(short[] s,
                                       int off,
                                       int length)

shortArrToByteArr

public static void shortArrToByteArr(byte[] b,
                                     int pos,
                                     short[] s,
                                     int off,
                                     int len)

uStringArrToByteArr

public static byte[] uStringArrToByteArr(java.lang.String[] s)

uStringArrToByteArr

public static byte[] uStringArrToByteArr(java.lang.String[] s,
                                         int off,
                                         int length)

uStringArrToByteArr

public static void uStringArrToByteArr(byte[] b,
                                       int pos,
                                       java.lang.String[] s,
                                       int off,
                                       int length)

aStringArrToByteArr

public static byte[] aStringArrToByteArr(java.lang.String[] s)

aStringArrToByteArr

public static byte[] aStringArrToByteArr(java.lang.String[] s,
                                         int off,
                                         int length)

aStringArrToByteArr

public static void aStringArrToByteArr(byte[] b,
                                       int pos,
                                       java.lang.String[] s,
                                       int off,
                                       int length)

byteArrToIntArr

public static int[] byteArrToIntArr(byte[] b)

byteArrToIntArr

public static int[] byteArrToIntArr(byte[] b,
                                    int off,
                                    int length)

byteArrToIntArr

public static void byteArrToIntArr(byte[] b,
                                   int off,
                                   int[] i,
                                   int pos,
                                   int length)

byteArrToLongArr

public static long[] byteArrToLongArr(byte[] b)

byteArrToLongArr

public static long[] byteArrToLongArr(byte[] b,
                                      int off,
                                      int length)

byteArrToLongArr

public static void byteArrToLongArr(byte[] b,
                                    int off,
                                    long[] l,
                                    int pos,
                                    int length)

byteArrToBooleanArr

public static boolean[] byteArrToBooleanArr(byte[] b)

byteArrToBooleanArr

public static boolean[] byteArrToBooleanArr(byte[] b,
                                            int off,
                                            int length)

byteArrToBooleanArr

public static void byteArrToBooleanArr(byte[] b,
                                       int off,
                                       boolean[] bool,
                                       int pos,
                                       int length)

byteArrToCharArr

public static char[] byteArrToCharArr(byte[] b)

byteArrToCharArr

public static char[] byteArrToCharArr(byte[] b,
                                      int off,
                                      int length)

byteArrToCharArr

public static void byteArrToCharArr(byte[] b,
                                    int off,
                                    char[] c,
                                    int pos,
                                    int length)

byteArrToShortArr

public static short[] byteArrToShortArr(byte[] b)

byteArrToShortArr

public static short[] byteArrToShortArr(byte[] b,
                                        int off,
                                        int length)

byteArrToShortArr

public static void byteArrToShortArr(byte[] b,
                                     int off,
                                     short[] s,
                                     int pos,
                                     int length)

byteArrToFloatArr

public static float[] byteArrToFloatArr(byte[] b)

byteArrToFloatArr

public static float[] byteArrToFloatArr(byte[] b,
                                        int off,
                                        int length)

byteArrToFloatArr

public static void byteArrToFloatArr(byte[] b,
                                     int off,
                                     float[] f,
                                     int pos,
                                     int length)

byteArrToDoubleArr

public static double[] byteArrToDoubleArr(byte[] b)
This method allocates a new double[] to return, based on the size of the array b (namely b.length / 8 in size)

Parameters:
b - Array to decode to doubles
Returns:
Array of doubles.

byteArrToDoubleArr

public static double[] byteArrToDoubleArr(byte[] b,
                                          int off,
                                          int length)

byteArrToDoubleArr

public static void byteArrToDoubleArr(byte[] b,
                                      int off,
                                      double[] d,
                                      int pos,
                                      int length)

byteArrToUStringArr

public static java.lang.String[] byteArrToUStringArr(byte[] b)

byteArrToUStringArr

public static java.lang.String[] byteArrToUStringArr(byte[] b,
                                                     int off,
                                                     int length)

byteArrToUStringArr

public static void byteArrToUStringArr(byte[] b,
                                       int off,
                                       java.lang.String[] s,
                                       int pos,
                                       int length)

byteArrToAStringArr

public static java.lang.String[] byteArrToAStringArr(byte[] b)

byteArrToAStringArr

public static java.lang.String[] byteArrToAStringArr(byte[] b,
                                                     int off,
                                                     int length)

byteArrToAStringArr

public static void byteArrToAStringArr(byte[] b,
                                       int off,
                                       java.lang.String[] s,
                                       int pos,
                                       int length)

saveDoubleArr

public static void saveDoubleArr(java.io.DataOutputStream rf,
                                 double[] arr)
                          throws java.io.IOException
Throws:
java.io.IOException

saveFloatArr

public static void saveFloatArr(java.io.DataOutputStream rf,
                                float[] arr)
                         throws java.io.IOException
Throws:
java.io.IOException

readDoubleArr

public static double[] readDoubleArr(java.io.DataInputStream rf)
                              throws java.io.IOException
Throws:
java.io.IOException

readFloatArr

public static float[] readFloatArr(java.io.DataInputStream rf)
                            throws java.io.IOException
Throws:
java.io.IOException


Stanford NLP Group