public class BaggageWriter extends java.lang.Object implements ElementWriter
Modifier and Type | Method and Description |
---|---|
java.util.List<java.nio.ByteBuffer> |
atoms()
Get the atoms that were written to this BaggageWriter
|
static BaggageWriter |
create() |
static BaggageWriter |
createAndMergeWith(java.lang.Iterable<java.nio.ByteBuffer> atoms) |
static BaggageWriter |
createAndMergeWith(java.lang.Iterable<java.nio.ByteBuffer> a0,
java.lang.Iterable<java.nio.ByteBuffer> a1) |
static BaggageWriter |
createAndMergeWith(java.util.Iterator<java.nio.ByteBuffer> atoms) |
static BaggageWriter |
createAndMergeWith(java.util.Iterator<java.nio.ByteBuffer> a0,
java.util.Iterator<java.nio.ByteBuffer> a1) |
BaggageWriter |
didOverflowHere(boolean didOverflow) |
BaggageWriter |
didTrimHere(boolean didTrim) |
BaggageWriter |
enter(BagKey field) |
BaggageWriter |
exit() |
void |
finish()
Indicate that writing to this writer has finished, and if the writer was also merging with other atoms, they
should be finished
|
void |
flush()
Ensure that any buffers created with newDataAtom are finished.
|
java.nio.ByteBuffer |
newDataAtom(int expectedSize)
Creates a byte buffer with
expectedSize bytes of free space. |
void |
sortData()
Sort any data written between the start of the current bag and now
|
BaggageWriter |
writeBytes(java.nio.ByteBuffer buf)
Write a data atom with the provided buf content
|
public static BaggageWriter create()
public static BaggageWriter createAndMergeWith(java.lang.Iterable<java.nio.ByteBuffer> atoms)
public static BaggageWriter createAndMergeWith(java.util.Iterator<java.nio.ByteBuffer> atoms)
public static BaggageWriter createAndMergeWith(java.lang.Iterable<java.nio.ByteBuffer> a0, java.lang.Iterable<java.nio.ByteBuffer> a1)
public static BaggageWriter createAndMergeWith(java.util.Iterator<java.nio.ByteBuffer> a0, java.util.Iterator<java.nio.ByteBuffer> a1)
public BaggageWriter enter(BagKey field)
public BaggageWriter exit()
public BaggageWriter didOverflowHere(boolean didOverflow)
public BaggageWriter didTrimHere(boolean didTrim)
public java.nio.ByteBuffer newDataAtom(int expectedSize)
expectedSize
bytes of free space. The atom can be written to as normal. Not
all of the free space must be fillednewDataAtom
in interface ElementWriter
expectedSize
- the amount of space neededexpectedSize
bytes remainingpublic BaggageWriter writeBytes(java.nio.ByteBuffer buf)
writeBytes
in interface ElementWriter
buf
- the payload of the data atom to writepublic void sortData()
sortData
in interface ElementWriter
public void flush()
flush
in interface ElementWriter
public void finish()
public java.util.List<java.nio.ByteBuffer> atoms()
Get the atoms that were written to this BaggageWriter
This method should not be called while writing is in progress