public final class TableDiskAccess extends TableAccess
Constructor and Description |
---|
TableDiskAccess(MetaData md,
boolean write)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the table access.
|
protected void |
copy(byte[] entries,
int pre,
int last)
Copies the specified values into the database.
|
void |
delete(int pre,
int nr)
Deletes the specified number of entries from the database.
|
protected void |
dirty()
Marks the data structures as dirty.
|
void |
flush(boolean all)
Flushes the table contents.
|
void |
insert(int pre,
byte[] entries)
Inserts the specified entries into the database.
|
boolean |
lock(boolean write)
Tries to acquires a lock on the table.
|
static boolean |
locked(String db,
Context ctx)
Checks if the table of the specified database is locked.
|
int |
read1(int pre,
int off)
Reads a byte value and returns it as an integer value.
|
int |
read2(int pre,
int off)
Reads a short value and returns it as an integer value.
|
int |
read4(int pre,
int off)
Reads an integer value.
|
long |
read5(int pre,
int off)
Reads a 5-byte value and returns it as a long value.
|
void |
write1(int pre,
int off,
int v)
Writes a byte value to the specified position.
|
void |
write2(int pre,
int off,
int v)
Writes a short value to the specified position.
|
void |
write4(int pre,
int off,
int v)
Writes an integer value to the specified position.
|
void |
write5(int pre,
int off,
long v)
Writes a 5-byte value to the specified position.
|
replace
public TableDiskAccess(MetaData md, boolean write) throws IOException
md
- meta datawrite
- write lockIOException
- I/O exceptionpublic static boolean locked(String db, Context ctx)
db
- name of databasectx
- database contextpublic void flush(boolean all) throws IOException
TableAccess
flush
in class TableAccess
all
- flush all contents or only buffersIOException
- I/O exceptionpublic void close() throws IOException
TableAccess
close
in class TableAccess
IOException
- I/O exceptionpublic boolean lock(boolean write)
TableAccess
lock
in class TableAccess
write
- write/read lockpublic int read1(int pre, int off)
TableAccess
read1
in class TableAccess
pre
- pre valueoff
- offsetpublic int read2(int pre, int off)
TableAccess
read2
in class TableAccess
pre
- pre valueoff
- offsetpublic int read4(int pre, int off)
TableAccess
read4
in class TableAccess
pre
- pre valueoff
- offsetpublic long read5(int pre, int off)
TableAccess
read5
in class TableAccess
pre
- pre valueoff
- offsetpublic void write1(int pre, int off, int v)
TableAccess
write1
in class TableAccess
pre
- pre valueoff
- offsetv
- value to be writtenpublic void write2(int pre, int off, int v)
TableAccess
write2
in class TableAccess
pre
- pre valueoff
- offsetv
- value to be writtenpublic void write4(int pre, int off, int v)
TableAccess
write4
in class TableAccess
pre
- pre valueoff
- offsetv
- value to be writtenpublic void write5(int pre, int off, long v)
TableAccess
write5
in class TableAccess
pre
- pre valueoff
- offsetv
- value to be writtenprotected void copy(byte[] entries, int pre, int last)
TableAccess
copy
in class TableAccess
entries
- entries to copypre
- first target pre valuelast
- last pre valuepublic void delete(int pre, int nr)
TableAccess
delete
in class TableAccess
pre
- pre value of the first node to deletenr
- number of entries to be deletedpublic void insert(int pre, byte[] entries)
TableAccess
insert
in class TableAccess
pre
- pre valueentries
- array of bytes containing the entries to insertprotected void dirty()
TableAccess
dirty
in class TableAccess
Copyright © 2005–2015 BaseX Team. All rights reserved.