|
|||||||||
| 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 access.
| 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. |
int |
firstID(int p)
Returns the first id of an index. |
void |
flush()
Flushes the buffered data. |
long |
length()
Returns file length. |
boolean |
more()
Checks if more bytes can be read. |
void |
next(int b)
Writes the next byte. |
long |
pos()
Returns the input position. |
int |
read()
Reads the next byte. |
int |
read4(long p)
Reads an integer value from the specified position. |
long |
read5(long p)
Reads a five-byte value from the specified position. |
byte[] |
readBytes(long p)
Reads a text from disk. |
byte[] |
readBytes(long from,
long to)
Reads a number of bytes in range from -> to and returns them as array. |
int |
readInt(long p)
Reads an integer value from the specified position. |
int[] |
readInts(long from,
long to)
Reads a number of int values in range from -> to and returns them as array. |
int |
readNum(long p)
Reads a Num value from disk. |
void |
writeBytes(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.io.File f)
throws java.io.IOException
f - the file to be read
java.io.IOException - IO Exception
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 Exception| Method Detail |
|---|
public void close()
throws java.io.IOException
java.io.IOException - in case of write errorspublic void cursor(long p)
p - read positionpublic int firstID(int p)
p - position
public void flush()
public long length()
public boolean more()
public void next(int b)
b - byte to be writtenpublic long pos()
public int read()
public int read4(long p)
p - position
public long read5(long p)
p - position
public byte[] readBytes(long p)
p - text position
public byte[] readBytes(long from,
long to)
from - starting position for readingto - ending position for reading
public int readInt(long p)
p - position
public int[] readInts(long from,
long to)
from - starting position for readingto - ending position for reading
public int readNum(long p)
Num value from disk.
p - text position
public void writeBytes(byte[] v)
v - byte array to be appended
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||