|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.io.DataAccess
public final class DataAccess
This class allows positional read and write access to a database file.
Constructor Summary | |
---|---|
DataAccess(java.io.File f)
Constructor, initializing the file reader. |
|
DataAccess(java.lang.String db,
java.lang.String fn)
Constructor, initializing the file reader. |
Method Summary | |
---|---|
void |
close()
Closes the data access. |
void |
cursor(long p)
Sets the disk cursor. |
void |
flush()
Flushes the buffered data. |
long |
length()
Returns file length. |
long |
pos()
Returns the current file position. |
int |
read()
Reads the next byte. |
long |
read5(long p)
Reads an 5-byte value from the specified file offset. |
byte |
readByte()
Reads a byte value. |
byte |
readByte(long p)
Reads a byte value from the specified position. |
byte[] |
readBytes(long from,
long to)
Reads a number of bytes in range from -> to and returns them as array. |
int |
readInt()
Reads an integer value from the specified position (without cursor correction). |
int |
readInt(long p)
Reads an integer value from the specified position. |
int |
readNum()
Reads the next compressed number and returns it as integer. |
int |
readNum(long p)
Reads a Num value from disk. |
byte[] |
readToken(long p)
Reads a token from disk. |
void |
writeBytes(long p,
byte[] v)
Append a value to the file and return it's offset. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataAccess(java.lang.String db, java.lang.String fn) throws java.io.IOException
db
- name of the databasefn
- the file to be read
java.io.IOException
- IO Exceptionpublic DataAccess(java.io.File f) throws java.io.IOException
f
- the file to be read
java.io.IOException
- IO ExceptionMethod Detail |
---|
public void flush() throws java.io.IOException
java.io.IOException
- in case of write errorspublic void close() throws java.io.IOException
java.io.IOException
- in case of write errorspublic long length()
public long read5(long p)
p
- position
public int readNum(long p)
Num
value from disk.
p
- text position
public byte[] readToken(long p)
p
- text position
public long pos()
public int readInt(long p)
p
- position
public byte readByte(long p)
p
- position
public byte readByte()
public byte[] readBytes(long from, long to)
from
- starting position for readingto
- ending position for reading
public void writeBytes(long p, byte[] v)
p
- write positionv
- byte array to be appendedpublic void cursor(long p)
p
- read positionpublic int read()
public int readNum()
public int readInt()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |