public class DurableBuffer extends java.lang.Object implements DurableOutput
DurableOutput which will incrementally flush its contents to disk.| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_BUFFER_SIZE |
| Constructor and Description |
|---|
DurableBuffer() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(java.lang.Iterable<IBuffer> buffers)
Appends
buffers to the output. |
void |
close() |
void |
flush()
Flushes any buffered data to the underlying sink.
|
void |
flushTo(DurableOutput out)
Writes the contents of the accumulator to
out, and frees the associated buffers. |
void |
flushTo(DurableOutput out,
BlockPrefix.BlockType type) |
static void |
flushTo(DurableOutput out,
BlockPrefix.BlockType type,
java.util.function.Consumer<DurableBuffer> body) |
static void |
flushTo(DurableOutput out,
java.util.function.Consumer<DurableBuffer> body) |
void |
free() |
IList<IBuffer> |
toBuffers() |
DurableInput |
toInput() |
void |
transferFrom(DurableInput in)
Copies all bytes from
in to the output. |
int |
write(java.nio.ByteBuffer src)
Copies all bytes from
src to the output, returning the number of bytes copied. |
void |
writeByte(int v)
Writes an
int8 to the output. |
void |
writeChar(int v)
Writes an
int16 to the output. |
void |
writeDouble(double v)
Writes a
float64 to the output. |
void |
writeFloat(float v)
Writes a
float32 to the output. |
void |
writeInt(int v)
Writes an
int32 to the output. |
void |
writeLong(long v)
Writes an
int64 to the output. |
void |
writeShort(int v)
Writes an
int16 to the output. |
long |
written() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasOutputStream, from, from, write, write, write, writeBoolean, writeBytes, writeChars, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUTF, writeUVLQ, writeVLQpublic static final int MAX_BUFFER_SIZE
public static void flushTo(DurableOutput out, java.util.function.Consumer<DurableBuffer> body)
public static void flushTo(DurableOutput out, BlockPrefix.BlockType type, java.util.function.Consumer<DurableBuffer> body)
public void flushTo(DurableOutput out)
out, and frees the associated buffers.public DurableInput toInput()
public void flushTo(DurableOutput out, BlockPrefix.BlockType type)
public void free()
public void close()
close in interface DurableOutputclose in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic void flush()
DurableOutputflush in interface DurableOutputflush in interface java.io.Flushablepublic long written()
written in interface DurableOutputpublic int write(java.nio.ByteBuffer src)
DurableOutputsrc to the output, returning the number of bytes copied.write in interface DurableOutputpublic void transferFrom(DurableInput in)
DurableOutputin to the output.transferFrom in interface DurableOutputpublic void append(java.lang.Iterable<IBuffer> buffers)
DurableOutputbuffers to the output.
Intended for internal use, may be subject to change.append in interface DurableOutputpublic void writeByte(int v)
DurableOutputint8 to the output.writeByte in interface DurableOutputwriteByte in interface java.io.DataOutputpublic void writeShort(int v)
DurableOutputint16 to the output.writeShort in interface DurableOutputwriteShort in interface java.io.DataOutputpublic void writeChar(int v)
DurableOutputint16 to the output.writeChar in interface DurableOutputwriteChar in interface java.io.DataOutputpublic void writeInt(int v)
DurableOutputint32 to the output.writeInt in interface DurableOutputwriteInt in interface java.io.DataOutputpublic void writeLong(long v)
DurableOutputint64 to the output.writeLong in interface DurableOutputwriteLong in interface java.io.DataOutputpublic void writeFloat(float v)
DurableOutputfloat32 to the output.writeFloat in interface DurableOutputwriteFloat in interface java.io.DataOutputpublic void writeDouble(double v)
DurableOutputfloat64 to the output.writeDouble in interface DurableOutputwriteDouble in interface java.io.DataOutput