|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.WeaselReader.PalmIO.Utility
public class Utility
A class of utility methods primarily focused on manipulating data within Palm OS database files. There are methods for converting Palm ID values, Palm date values, reading/writing unsigned 32bit int values, and pretty-printing a byte array.
| Constructor Summary | |
|---|---|
Utility()
|
|
| Method Summary | |
|---|---|
static long |
fromUInt32(byte[] buf,
int i)
Convert an unsigned 32 bit value (UInt32) to a long without losing the original unsigned value. |
static java.lang.String |
idToString(long id)
Convert a Palm OS database 'ID' from a four byte value to a four character String so it can be printed. |
static void |
printDataBlock(java.io.PrintStream out,
int bytesPerLine,
byte[] data,
int startOffset,
int length,
long address)
Output a block of data in mixed hex/ASCII format. |
static long |
stringToID(java.lang.String id)
Convert a String representation of a Palm OS database 'ID' back into a standard four byte literal value. |
static long |
toPalmEpoch(java.util.Date time)
Convert a Java Date (which uses the standard UNIX time epoch) into a seconds count in the Palm epoch suitable for use in any of the time fields in the PalmDB class. |
static void |
toUInt32(long val,
byte[] buf,
int i)
Put an unsigned 32 bit value stored in a long into a byte array at the specified index. |
static java.util.Date |
toUNIXEpoch(long palmTime)
Convert a Palm OS date (a long count of seconds) from the Palm OS epoch to a Date in the standard UNIX epoch. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utility()
| Method Detail |
|---|
public static java.lang.String idToString(long id)
id - the ID value to be converted.
public static long stringToID(java.lang.String id)
id - the ID String to convert.
public static long fromUInt32(byte[] buf,
int i)
buf - the array containing the value to be converted.i - the index of the array element to be converted.
public static void toUInt32(long val,
byte[] buf,
int i)
val - a long containing a UInt32 value to be stored.buf - the byte array in which to store the UInt32 value.i - the index of the array element to store the new value in.public static long toPalmEpoch(java.util.Date time)
time - a point in time represented by a Java Date object.
public static java.util.Date toUNIXEpoch(long palmTime)
palmTime - a point in time expressed as a seconds count in the Palm OS
epoch.
public static void printDataBlock(java.io.PrintStream out,
int bytesPerLine,
byte[] data,
int startOffset,
int length,
long address)
out - the stream to output to, such as System.out for standard output.bytesPerLine - the number of data bytes to print per line. This
value will be rounded down to a multiple of four.data - the byte array containing the data to be printed.startOffset - the offset in the data array at which to begin.length - the number of bytes from the data array to print.address - the memory address this block of data represents. Or, just
pass 0 for it to count from the beginning of the startOffset.
This is only for readability and convenience and has no effect
on how the data is output.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||