|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.util.Utilities
Provides a set of generic utilities
Method Summary | |
static java.lang.String |
doubleToScientificString(double number,
int fractionDigits)
Returns the string representation of the given double value in normalized scientific notation. |
static void |
dump(java.io.PrintWriter pw,
int padding,
java.lang.String string)
Dumps padded text. |
static void |
dumpMemoryInfo(java.lang.String msg)
Dumps out memory information |
static boolean |
isCepstraFileBigEndian(java.lang.String filename)
Returns true if the given binary cepstra file is in big-endian format. |
static void |
objectTracker(java.lang.String name,
int count)
utility method for tracking object counts |
static java.lang.String |
pad(double val,
int minLength)
Pads with spaces or truncates the given double to guarantee that it is exactly the desired length. |
static java.lang.String |
pad(int padding)
Returns a string with the given number of spaces. |
static java.lang.String |
pad(int val,
int minLength)
Pads with spaces or truncates the given int to guarantee that it is exactly the desired length. |
static java.lang.String |
pad(java.lang.String string,
int minLength)
Pads with spaces or truncates the given string to guarantee that it is exactly the desired length. |
static float |
readLittleEndianFloat(java.io.DataInputStream dataStream)
Reads the next float from the given DataInputStream, where the data is in little endian. |
static int |
readLittleEndianInt(java.io.DataInputStream dataStream)
Reads the next little-endian integer from the given DataInputStream. |
static float |
swapFloat(float floatValue)
Byte-swaps the given float to the other endian. |
static int |
swapInteger(int integer)
Byte-swaps the given integer to the other endian. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.String pad(int padding)
padding
- the number of spaces in the string
public static java.lang.String pad(java.lang.String string, int minLength)
string
- the string to be paddedminLength
- the desired length of the string
public static java.lang.String pad(int val, int minLength)
val
- the val to be paddedminLength
- the desired length of the string
public static java.lang.String pad(double val, int minLength)
val
- the val to be paddedminLength
- the desired length of the string
public static void dump(java.io.PrintWriter pw, int padding, java.lang.String string)
pw
- the stream to send the outputpadding
- the number of spaces in the stringstring
- the string to outputpublic static void objectTracker(java.lang.String name, int count)
name
- the name of the objectcount
- the count of objectspublic static void dumpMemoryInfo(java.lang.String msg)
msg
- addditional text for the dumppublic static java.lang.String doubleToScientificString(double number, int fractionDigits)
fractionDigits
argument gives the number of decimal digits in the fraction
portion. For example, if fractionDigits
is 4, then
the 123450 will be "1.2345e+05". There will always be two digits
in the exponent portion, and a plus or minus sign before the
exponent.
number
- the double to convertfractionDigits
- the number of digits in the fraction part,
e.g., 4 in "1.2345e+05".
public static boolean isCepstraFileBigEndian(java.lang.String filename) throws java.io.IOException
filename
- the cepstra file name
java.io.IOException
public static float readLittleEndianFloat(java.io.DataInputStream dataStream) throws java.io.IOException
dataStream
- the DataInputStream to read from
java.io.IOException
public static int readLittleEndianInt(java.io.DataInputStream dataStream) throws java.io.IOException
dataStream
- the DataInputStream to read from
java.io.IOException
public static int swapInteger(int integer)
integer
- the integer to swappublic static float swapFloat(float floatValue)
floatValue
- the float to swap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |