public class PdbFile extends RandomAccessFile
Modifier and Type | Method and Description |
---|---|
static String |
convertSpecialChars(String str)
Converts special PalmOS characters into their unicode equivalents.
|
int |
readCategories(CategoryAppInfo appInfo)
Reads the categories from a standard appinfo area and fills them into a
CategoryAppInfo object. |
<T extends Record,U extends AppInfo> |
readDatabase(Converter<T,U> converter)
Reads the entire database file and returns a
PdbDatabase . |
Calendar |
readDate()
Reads a PalmOS date.
|
Calendar |
readDateTimeWords()
Reads a PalmOS date and time that is stored in seven words.
|
String |
readFixedString(int length)
Reads a string of a fixed length, not null terminated.
|
Calendar |
readPackedDate()
Reads a packed PalmOS date.
|
String |
readTerminatedFixedString(int length)
Reads a string of a fixed length that is null terminated.
|
String |
readTerminatedString()
Reads a string of a variable length that is null terminated.
|
long |
readUnsignedInt()
Reads an unsigned integer.
|
close, getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
public PdbFile(File file) throws FileNotFoundException
file
- File
to be openedFileNotFoundException
public <T extends Record,U extends AppInfo> PdbDatabase<T,U> readDatabase(Converter<T,U> converter) throws IOException
PdbDatabase
. You usually want
to invoke this method, as the other methods are just helpers.T
- Record
subclass the database shall consist ofconverter
- Converter
that converts the raw database entries into
Record
objectsPdbDatabase
containing the file contentsIOException
- The file could not be read. This can have various reasons, for example
if the file was no valid PDB file or the converter was not able to
convert the file's contents.public String readFixedString(int length) throws IOException
length
- The length of the stringIOException
public String readTerminatedFixedString(int length) throws IOException
length
- The length of the stringIOException
public String readTerminatedString() throws IOException
IOException
public long readUnsignedInt() throws IOException
IOException
public Calendar readDate() throws IOException
null
if no date was set.IOException
public Calendar readPackedDate() throws IOException
null
if no date
was set. The time part is always midnight local time.IOException
public Calendar readDateTimeWords() throws IOException
IOException
public int readCategories(CategoryAppInfo appInfo) throws IOException
CategoryAppInfo
object. After invocation, the file pointer points after the
category part, where further application information may be stored.appInfo
- CategoryAppInfo
where the categories are stored.IOException
public static String convertSpecialChars(String str)
PdbFile
will invoke this method by itself, so you usually do not
need to invoke it. Note that some very special PalmOS characters cannot be
converted (as there are no unicode equivalents) and will be kept unchanged.str
- String to be convertedCopyright © 2009–2016. All rights reserved.