public final class JFile
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
JFile(int handle,
java.lang.String name,
JConnection conn) |
Modifier and Type | Method and Description |
---|---|
void |
clearFile()
Clears the file
|
void |
close()
Closes the file and releases the server-side handle
|
void |
delete(java.lang.String key)
Deletes a record with the given key
|
protected void |
finalize() |
protected int |
getHandle() |
JDynArray |
getIndex(java.lang.String indexName)
Reads information about the specified index
|
java.lang.String |
getPath()
Retrieves the file path
|
JIndex |
openIndex(java.lang.String indexName)
Opens a named index on this file
|
JDynArray |
read(java.lang.String key)
Reads a record from the file without locking
|
JDynArray |
read(java.lang.String key,
boolean locked)
Reads a record from the file, optionally locking it
|
JDynArray |
read(java.lang.String key,
boolean locked,
boolean wait)
Reads a record from the file, optionally locking it and waiting for the lock
|
JDynArray |
readNamedField(java.lang.String key,
java.lang.String field)
Reads a named field from a file record
|
JDynArray |
readNamedField(java.lang.String key,
java.lang.String field,
boolean locked)
Reads a named field from a file record, optionally locking the record
|
JDynArray |
readNamedField(java.lang.String key,
java.lang.String field,
boolean locked,
boolean wait)
Reads a named field from a file record, optionally locking the record
|
JDynArray |
readV(java.lang.String key,
int attrib)
Reads an attribute from a file record without locking
|
JDynArray |
readV(java.lang.String key,
int attrib,
boolean locked)
Reads an attribute from a file record, optionally locking the record
|
JDynArray |
readV(java.lang.String key,
int attrib,
boolean locked,
boolean wait)
Reads an attribute from a file record, optionally locking the record
and waiting for the lock
|
void |
release(java.lang.String key)
Releases a lock on a file record
|
void |
releaseAll()
Releases all locks held by the current session on the given file
|
JSelectList |
select()
Selects all keys in the file in hash order
|
JSelectList |
sselect()
Selects all keys in the file in ascending sorted order
|
void |
write(java.lang.String key,
JDynArray data)
Writes a record to the file releasing the lock if there is one
|
void |
write(java.lang.String key,
JDynArray data,
boolean unlock)
Writes a record to the file optionally releasing the lock
|
void |
writeNamedField(java.lang.String key,
java.lang.String field,
JDynArray data)
Writes a named record field to the file
|
void |
writeNamedField(java.lang.String key,
java.lang.String field,
JDynArray data,
boolean unlock)
Writes a named record field to the file optionally releasing the lock
|
void |
writeV(java.lang.String key,
JDynArray data,
int attrib)
Writes a record attribute to the file releasing the lock if there is one
|
void |
writeV(java.lang.String key,
JDynArray data,
int attrib,
boolean unlock)
Writes a record attribute to the file optionally releasing the lock
|
protected JFile(int handle, java.lang.String name, JConnection conn)
public void clearFile() throws JException
JException
public void close() throws JException
JException
public void delete(java.lang.String key) throws JException
key
- Record keyJException
public JDynArray getIndex(java.lang.String indexName) throws JException
indexName
- Index name to queryJException
public JIndex openIndex(java.lang.String indexName) throws JException
indexName
- Index nameJException
public java.lang.String getPath() throws JException
JException
public JDynArray read(java.lang.String key, boolean locked, boolean wait) throws JException
key
- Record key to readlocked
- If true, performs a READU instead of READ to lock the recordwait
- If true and the locked parameter is specified, the program
will wait for the lock rather than failingJException
public JDynArray read(java.lang.String key, boolean locked) throws JException
key
- Record key to readlocked
- If true, performs a READU instead of READ to lock the record.
The method will fail immediately if it cannot obtain the lockJException
public JDynArray read(java.lang.String key) throws JException
key
- Record key to readJException
public JDynArray readV(java.lang.String key, int attrib, boolean locked, boolean wait) throws JException
key
- Record key to readattrib
- Attribute number to readlocked
- If true, performs a READVU instead of READV to lock the recordwait
- If true and the locked parameter is specified, the program
will wait for the lock rather than failingJException
public JDynArray readV(java.lang.String key, int attrib, boolean locked) throws JException
key
- Record key to readattrib
- Attribute number to readlocked
- If true, performs a READVU instead of READV to lock the record.
The method will fail immediately if the record cannot be lockedJException
public JDynArray readV(java.lang.String key, int attrib) throws JException
key
- Record key to readattrib
- Attribute number to readJException
public void release(java.lang.String key) throws JException
key
- Record keyJException
public void releaseAll() throws JException
JException
public JSelectList select() throws JException
JException
public JSelectList sselect() throws JException
JException
public void write(java.lang.String key, JDynArray data, boolean unlock) throws JException
key
- Record key to writedata
- Record dataunlock
- If true, unlocks the record after writing. Otherwise a
WRITEU is performed and the lock is keptJException
public void write(java.lang.String key, JDynArray data) throws JException
key
- Record key to writedata
- Record dataJException
public void writeV(java.lang.String key, JDynArray data, int attrib, boolean unlock) throws JException
key
- Record key to writedata
- Attribute dataattrib
- Attribute number to writeunlock
- If true, unlocks the record after writing. Otherwise a
WRITEVU is performed and the lock is keptJException
public JDynArray readNamedField(java.lang.String key, java.lang.String field, boolean locked, boolean wait) throws JException
key
- Record key to readfield
- Field name to readlocked
- If true, performs a READVU instead of READV to lock the record.wait
- If true and the locked parameter is specified, the program
will wait for the lock rather than failingJException
public JDynArray readNamedField(java.lang.String key, java.lang.String field, boolean locked) throws JException
key
- Record key to readfield
- Field name to readlocked
- If true, performs a READVU instead of READV to lock the record.
The method will fail immediately if the record cannot be lockedJException
public JDynArray readNamedField(java.lang.String key, java.lang.String field) throws JException
key
- Record key to readfield
- Field name to readJException
public void writeNamedField(java.lang.String key, java.lang.String field, JDynArray data, boolean unlock) throws JException
key
- Record key to writefield
- Field name to writedata
- Field dataunlock
- If true, unlocks the record after writing. Otherwise a
WRITEVU is performed and the lock is keptJException
public void writeNamedField(java.lang.String key, java.lang.String field, JDynArray data) throws JException
key
- Record key to writefield
- Field name to writedata
- Field dataJException
public void writeV(java.lang.String key, JDynArray data, int attrib) throws JException
key
- Record key to writedata
- Attribute dataattrib
- Attribute number to writeJException
protected int getHandle()
protected void finalize()
finalize
in class java.lang.Object