public final class RemotePDBFile
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
lastSearchedRec |
protected int |
mode |
protected java.lang.String |
name |
protected boolean |
open |
protected int |
recIndex |
static int |
RECORD_SIZE_AUTO |
protected int |
wRecordSize |
Constructor and Description |
---|
RemotePDBFile(java.lang.String name)
Opens a remote PDBFile in READ_WRITE mode.
|
RemotePDBFile(java.lang.String name,
int mode)
Opens a remote PDBFile in the given mode.
|
RemotePDBFile(java.lang.String name,
int mode,
int recordSize)
Opens a remote PDBFile with the given name.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this PDBFile.
|
void |
delete()
Completely deletes this database, closing it first.
|
void |
deleteRecord(int index)
Deletes the given record index.
|
protected void |
finalize() |
int |
getNextModifiedRecordIndex()
Returns the next modified record index.
|
int |
getRecordCount()
Returns the number of records inside this database
|
int |
getRecordPos()
Returns the current record position or -1 if there is no current record.
|
static java.lang.String[] |
listPDBs(int crtr,
int type)
Lists the available PDBFiles on the device that has the given creator id
and type.
|
boolean |
readRecord(int index,
RemotePDBRecord rec)
Fetches the given index, passing to the rec a DataStream to read the
record information.
|
int |
skipBytes(int n)
Moves the cursor n bytes from the current position, moving backwards if n is negative, or forward if n is
positive.
The cursor cannot be placed outside the stream limits, stopping at position 0 when moving backwards, or at the last position of the stream, when moving forward. |
boolean |
writeRecord(int index,
RemotePDBRecord rec)
Write the record at the given index.
|
protected java.lang.String name
protected int mode
protected boolean open
protected int recIndex
protected int wRecordSize
protected int lastSearchedRec
public static int RECORD_SIZE_AUTO
public RemotePDBFile(java.lang.String name, int mode, int recordSize) throws IllegalArgumentIOException, FileNotFoundException, IOException
name
- The PDBFile name on the form name.crtr.type
mode
- Can be PDBFile.READ_WRITE, PDBFile.CREATE (this one is non
destructive: if the PDBFile don't exists, it will be created and
it will remain open on READ_WRITE mode; if it exists, it will
stay open on READ_WRITE mode). You can also or the mode with
PDBFile.DB_ATTR_BACKUP or PDBFile.DB_ATTR_STREAM to set these
attributes when creating a database (do NOT use the other
attributes!)recordSize
- Used only when writing records. If you plan to write records
with fixed size, pass in the desired size. Otherwise, pass
RemotePDBFile.RECORD_SIZE_AUTO to automatically expand or shrink
the record.IOException
FileNotFoundException
IllegalArgumentIOException
public RemotePDBFile(java.lang.String name) throws IllegalArgumentIOException, FileNotFoundException, IOException
public RemotePDBFile(java.lang.String name, int mode) throws IllegalArgumentIOException, FileNotFoundException, IOException
public final void delete() throws IOException
IOException
public final int getRecordCount() throws IOException
IOException
public boolean readRecord(int index, RemotePDBRecord rec) throws IllegalArgumentIOException, IOException
public boolean writeRecord(int index, RemotePDBRecord rec) throws IllegalArgumentIOException, IOException
public int getRecordPos()
public final void deleteRecord(int index) throws IllegalArgumentIOException, IOException
delete
and then create it again.public int skipBytes(int n)
n
- the number of bytes to move.public final int getNextModifiedRecordIndex() throws IOException
IOException
public final void close() throws IOException
IOException
public static java.lang.String[] listPDBs(int crtr, int type)
protected void finalize()
finalize
in class java.lang.Object