public final class DataOutput extends 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(OutputStream os)
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.
|
write, write
public DataOutput(OutputStream os)
os
- output stream to operate onpublic DataOutput(IOFile db) throws IOException
db
- name of the databaseIOException
- I/O exceptionpublic DataOutput(IOFile db, int bufs) throws IOException
db
- name of the databasebufs
- size of the buffer to useIOException
- I/O exceptionpublic void write(int b) throws IOException
write
in class OutputStream
IOException
public void writeBool(boolean b) throws IOException
b
- boolean valueIOException
- I/O exceptionpublic int writeToken(byte[] tok) throws IOException
tok
- array to be writtenIOException
- I/O exceptionpublic int writeDouble(double num) throws IOException
num
- array to be writtenIOException
- I/O exceptionpublic void writeTokens(byte[][] array) throws IOException
null
references are replaced by an empty array.array
- array to be writtenIOException
- I/O exceptionpublic void writeDiffs(IntList array) throws IOException
array
- array to be writtenIOException
- I/O exceptionpublic void writeNums(int[] array) throws IOException
Num
for more.array
- array to be writtenIOException
- I/O exceptionpublic int writeNum(int v) throws IOException
Num
for more.
By compressing, the size of the database files is reduced.v
- value to be writtenIOException
- I/O exceptionpublic void writeLongs(long[] array) throws IOException
array
- array to be writtenIOException
- I/O exceptionpublic void write1(int v) throws IOException
v
- value to be writtenIOException
- I/O exceptionpublic void write2(int v) throws IOException
v
- value to be writtenIOException
- I/O exceptionpublic void write4(int v) throws IOException
v
- value to be writtenIOException
- I/O exceptionpublic void write5(long v) throws IOException
v
- value to be writtenIOException
- I/O exceptionpublic void writeBytes(byte[] bytes) throws IOException
bytes
- array to be writtenIOException
- I/O exceptionpublic long size()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2005–2015 BaseX Team. All rights reserved.