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.

Method Index

 o asciiToInt(String)
Converts an ASCII string into an integer.
 o bytesToInt(byte[], int)
Convert four bytes of a byte array into an integer.
 o bytesToShort(byte[], int)
Convert two bytes of a byte array into a short.
 o getFileNameFromUser()
Display a FileDialog and return a full path name.
 o intToAscii(int)
Convert an integer into a four character string.
 o pascalBytesToString(byte[], int)
Read a pascal-style string from a byte array.
 o stringToPascalBytes(String, byte[], int)
Convert a java string into a Pascal string, and put it at the indicated position of a byte array.

Methods

 o getFileNameFromUser
  public static String getFileNameFromUser()
Display a FileDialog and return a full path name. Returns null if the user chooses 'Cancel'.
 o 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
 o 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
 o 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".
 o 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.
 o 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.
 o 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