|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.io.random.DataAccess
public final class DataAccess
This class allows positional read and write access to a database file.
Constructor Summary | |
---|---|
DataAccess(IOFile f)
Constructor, initializing the file reader. |
Method Summary | |
---|---|
long |
appendNums(int[] v)
Appends integers to the file in compressed form. |
void |
close()
Closes the data access. |
long |
cursor()
Returns the current file position. |
void |
cursor(long p)
Sets the disk cursor. |
void |
flush()
Flushes the buffered data. |
long |
free(long pos,
int size)
Returns the offset to a free slot for writing an entry with the specified length. |
long |
length()
Returns the file length. |
boolean |
more()
Checks if more bytes can be read. |
byte |
read1()
Reads a byte value. |
byte |
read1(long p)
Reads a byte value from the specified position. |
int |
read4()
Reads an integer value. |
int |
read4(long p)
Reads an integer value from the specified position. |
long |
read5()
Reads a 5-byte value. |
long |
read5(long p)
Reads a 5-byte value from the specified file offset. |
byte[] |
readBytes(int n)
Reads a number of bytes. |
byte[] |
readBytes(long p,
int l)
Reads a number of bytes from the specified offset. |
int |
readNum()
Reads the next compressed number and returns it as integer. |
int |
readNum(long p)
Reads a Num value from disk. |
byte[] |
readToken()
Reads the next token from disk. |
byte[] |
readToken(long p)
Reads a token from disk. |
void |
write4(int v)
Writes an integer value to the current position. |
void |
write4(long p,
int v)
Writes an integer value to the specified position. |
void |
write5(long p,
long v)
Writes a 5-byte value to the specified position. |
void |
writeNum(long p,
int v)
Write a value to the file. |
void |
writeNums(long p,
int[] v)
Writes integers to the file in compressed form. |
void |
writeToken(byte[] buf,
int offset,
int length)
Write a token to the file. |
void |
writeToken(long p,
byte[] v)
Appends a value to the file and return it's offset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataAccess(IOFile f) throws java.io.IOException
f
- the file to be read
java.io.IOException
- I/O ExceptionMethod Detail |
---|
public void flush()
public void close()
public long cursor()
public long length()
public boolean more()
public byte read1(long p)
p
- position
public byte read1()
public int read4(long p)
p
- position
public int read4()
public long read5(long p)
p
- position
public long read5()
public int readNum(long p)
Num
value from disk.
p
- text position
public byte[] readToken(long p)
p
- text position
public byte[] readToken()
public byte[] readBytes(long p, int l)
p
- positionl
- length
public byte[] readBytes(int n)
n
- length
public void cursor(long p)
p
- read positionpublic int readNum()
public void write5(long p, long v)
p
- position in the filev
- value to be writtenpublic void write4(long p, int v)
p
- write positionv
- byte array to be appendedpublic void write4(int v)
v
- value to be writtenpublic void writeNum(long p, int v)
p
- write positionv
- value to be writtenpublic void writeNums(long p, int[] v)
p
- write positionv
- integer valuespublic long appendNums(int[] v)
v
- integer values
public void writeToken(long p, byte[] v)
p
- write positionv
- byte array to be appendedpublic void writeToken(byte[] buf, int offset, int length)
buf
- buffer containing the tokenoffset
- offset in the buffer where the token startslength
- token lengthpublic long free(long pos, int size)
pos
- original offsetsize
- size of new text entry
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |