Class COM.tolstoy.jconfig.JUtils
All Packages Class Hierarchy This Package Previous Next Index
Class COM.tolstoy.jconfig.JUtils
java.lang.Object
|
+----COM.tolstoy.jconfig.JUtils
- public class JUtils
- extends Object
Contains various utility routines.
-
asciiToInt(String)
- Converts an ASCII string into an integer.
-
bytesToInt(byte[], int)
- Convert four bytes of a byte array into an integer.
-
bytesToShort(byte[], int)
- Convert two bytes of a byte array into a short.
-
getFileNameFromUser()
- Display a FileDialog and return a full path name.
-
intToAscii(int)
- Convert an integer into a four character string.
-
pascalBytesToString(byte[], int)
- Read a pascal-style string from a byte array.
-
stringToPascalBytes(String, byte[], int)
- Convert a java string into a Pascal string, and put it at the indicated position of a byte
array.
getFileNameFromUser
public static String getFileNameFromUser()
- Display a FileDialog and return a full path name. Returns null if the user chooses 'Cancel'.
bytesToShort
public final static short bytesToShort(byte buf[],
int offset)
- Convert two bytes of a byte array into a short. Big-endian.
- Parameters:
- offset - the offset at which to start
bytesToInt
public final static int bytesToInt(byte buf[],
int offset)
- Convert four bytes of a byte array into an integer. Big-endian.
- Parameters:
- offset - the offset at which to start
asciiToInt
public final static int asciiToInt(String s)
- Converts an ASCII string into an integer. The string must contain exactly 4 characters,
e.g, "TEXT".
intToAscii
public final static String intToAscii(int n)
- Convert an integer into a four character string. If any characters would be zero,
they are replaced with spaces.
stringToPascalBytes
public final static void stringToPascalBytes(String s,
byte record[],
int offset)
- Convert a java string into a Pascal string, and put it at the indicated position of a byte
array.
pascalBytesToString
public final static String pascalBytesToString(byte record[],
int offset)
- Read a pascal-style string from a byte array.
All Packages Class Hierarchy This Package Previous Next Index