Class ByteSlot
java.lang.Object
java.io.OutputStream
org.apache.hadoop.hbase.procedure2.util.ByteSlot
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
Similar to the ByteArrayOutputStream, with the exception that we can prepend an header. e.g. you
write some data and you want to prepend an header that contains the data len or cksum.
ByteSlot slot = new ByteSlot();
// write data
slot.write(...);
slot.write(...);
// write header with the size of the written data
slot.markHead();
slot.write(Bytes.toBytes(slot.size()));
// flush to stream as [header, data]
slot.writeTo(stream);
-
Field Summary
Modifier and TypeFieldDescriptionprivate byte[]
private static final int
private int
private static final int
private static final int
private static final int
private int
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write
-
Field Details
-
LARGE_GROW_SIZE_THRESHOLD
- See Also:
-
LARGE_GROW_SIZE
- See Also:
-
RESET_THRESHOLD
- See Also:
-
GROW_ALIGN
- See Also:
-
buf
-
head
-
size
-
-
Constructor Details
-
ByteSlot
public ByteSlot()
-
-
Method Details
-
reset
-
markHead
-
getHead
-
size
-
getBuffer
-
writeAt
-
write
- Specified by:
write
in classOutputStream
-
write
- Overrides:
write
in classOutputStream
-
writeTo
- Throws:
IOException
-
ensureCapacity
-