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
FieldsModifier and TypeFieldDescriptionprivate byte[]private static final intprivate intprivate static final intprivate static final intprivate static final intprivate int -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.OutputStream
close, flush, 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:
writein classOutputStream
-
write
- Overrides:
writein classOutputStream
-
writeTo
- Throws:
IOException
-
ensureCapacity
-