|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.basex.io.out.DataOutput
public final class DataOutput
This is an output stream for project specific data types.
It bears resemblance to Java's DataOutputStream
.
Constructor Summary | |
---|---|
DataOutput(IOFile db)
Constructor, specifying a file. |
|
DataOutput(IOFile db,
int bufs)
Constructor, specifying a file and a buffer size. |
|
DataOutput(java.io.OutputStream out)
Constructor, specifying an output stream. |
Method Summary | |
---|---|
void |
close()
|
void |
flush()
|
long |
size()
Returns the number of written bytes. |
void |
write(int b)
|
void |
write1(int v)
Writes a byte value. |
void |
write2(int v)
Writes a short value. |
void |
write4(int v)
Writes an integer value. |
void |
write5(long v)
Writes 5 bytes of a long value. |
void |
writeBool(boolean b)
Writes a boolean value. |
void |
writeBytes(byte[] bytes)
Writes a byte array. |
void |
writeDiffs(IntList array)
Writes distances between integers. |
int |
writeDouble(double num)
Writes a double value. |
void |
writeLongs(long[] array)
Writes long values. |
int |
writeNum(int v)
Writes a compressed integer value; see Num for more. |
void |
writeNums(int[] array)
Writes compressed numbers; see Num for more. |
int |
writeToken(byte[] tok)
Writes a token, represented by its compressed length and its byte array. |
void |
writeTokens(byte[][] array)
Writes tokens. |
Methods inherited from class java.io.OutputStream |
---|
write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataOutput(java.io.OutputStream out)
out
- output stream to operate onpublic DataOutput(IOFile db) throws java.io.IOException
db
- name of the database
java.io.IOException
- I/O exceptionpublic DataOutput(IOFile db, int bufs) throws java.io.IOException
db
- name of the databasebufs
- size of the buffer to use
java.io.IOException
- I/O exceptionMethod Detail |
---|
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void writeBool(boolean b) throws java.io.IOException
b
- boolean value
java.io.IOException
- I/O exceptionpublic int writeToken(byte[] tok) throws java.io.IOException
tok
- array to be written
java.io.IOException
- I/O exceptionpublic int writeDouble(double num) throws java.io.IOException
num
- array to be written
java.io.IOException
- I/O exceptionpublic void writeTokens(byte[][] array) throws java.io.IOException
null
references are replaced by an empty array.
array
- array to be written
java.io.IOException
- I/O exceptionpublic void writeDiffs(IntList array) throws java.io.IOException
array
- array to be written
java.io.IOException
- I/O exceptionpublic void writeNums(int[] array) throws java.io.IOException
Num
for more.
array
- array to be written
java.io.IOException
- I/O exceptionpublic int writeNum(int v) throws java.io.IOException
Num
for more.
By compressing, the size of the database files is reduced.
v
- value to be written
java.io.IOException
- I/O exceptionpublic void writeLongs(long[] array) throws java.io.IOException
array
- array to be written
java.io.IOException
- I/O exceptionpublic void write1(int v) throws java.io.IOException
v
- value to be written
java.io.IOException
- I/O exceptionpublic void write2(int v) throws java.io.IOException
v
- value to be written
java.io.IOException
- I/O exceptionpublic void write4(int v) throws java.io.IOException
v
- value to be written
java.io.IOException
- I/O exceptionpublic void write5(long v) throws java.io.IOException
v
- value to be written
java.io.IOException
- I/O exceptionpublic void writeBytes(byte[] bytes) throws java.io.IOException
bytes
- array to be written
java.io.IOException
- I/O exceptionpublic long size()
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |