public final class DataOutput
extends java.io.OutputStream
DataOutputStream.| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public DataOutput(java.io.OutputStream out)
out - output stream to operate onpublic DataOutput(IOFile db) throws java.io.IOException
db - name of the databasejava.io.IOException - I/O exceptionpublic DataOutput(IOFile db, int bufs) throws java.io.IOException
db - name of the databasebufs - size of the buffer to usejava.io.IOException - I/O exceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void writeBool(boolean b)
throws java.io.IOException
b - boolean valuejava.io.IOException - I/O exceptionpublic int writeToken(byte[] tok)
throws java.io.IOException
tok - array to be writtenjava.io.IOException - I/O exceptionpublic int writeDouble(double num)
throws java.io.IOException
num - array to be writtenjava.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 writtenjava.io.IOException - I/O exceptionpublic void writeDiffs(IntList array) throws java.io.IOException
array - array to be writtenjava.io.IOException - I/O exceptionpublic void writeNums(int[] array)
throws java.io.IOException
Num for more.array - array to be writtenjava.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 writtenjava.io.IOException - I/O exceptionpublic void writeLongs(long[] array)
throws java.io.IOException
array - array to be writtenjava.io.IOException - I/O exceptionpublic void write1(int v)
throws java.io.IOException
v - value to be writtenjava.io.IOException - I/O exceptionpublic void write2(int v)
throws java.io.IOException
v - value to be writtenjava.io.IOException - I/O exceptionpublic void write4(int v)
throws java.io.IOException
v - value to be writtenjava.io.IOException - I/O exceptionpublic void write5(long v)
throws java.io.IOException
v - value to be writtenjava.io.IOException - I/O exceptionpublic void writeBytes(byte[] bytes)
throws java.io.IOException
bytes - array to be writtenjava.io.IOException - I/O exceptionpublic long size()
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException