public final class GrowableByteArrayDataOutput extends DataOutput
DataOutput that can be used to build a byte[].| Modifier and Type | Field and Description |
|---|---|
private byte[] |
bytes
The bytes
|
private int |
length
The length
|
(package private) static int |
MIN_UTF8_SIZE_TO_ENABLE_DOUBLE_PASS_ENCODING
Minimum utf8 byte size of a string over which double pass over string is to save memory during encode
|
private byte[] |
scratchBytes |
| Constructor and Description |
|---|
GrowableByteArrayDataOutput(int cp)
Create a
GrowableByteArrayDataOutput with the given initial capacity. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytes() |
int |
getPosition() |
void |
reset() |
void |
writeByte(byte b)
Writes a single byte.
|
void |
writeBytes(byte[] b,
int off,
int len)
Writes an array of bytes.
|
void |
writeString(java.lang.String string)
Writes a string.
|
copyBytes, writeBytes, writeInt, writeLong, writeMapOfStrings, writeSetOfStrings, writeShort, writeVInt, writeVLong, writeZInt, writeZLongstatic final int MIN_UTF8_SIZE_TO_ENABLE_DOUBLE_PASS_ENCODING
private byte[] bytes
private int length
private byte[] scratchBytes
public GrowableByteArrayDataOutput(int cp)
GrowableByteArrayDataOutput with the given initial capacity.public void writeByte(byte b)
DataOutputThe most primitive data type is an eight-bit byte. Files are accessed as sequences of bytes. All other data types are defined as sequences of bytes, so file formats are byte-order independent.
writeByte in class DataOutputDataInput.readByte()public void writeBytes(byte[] b,
int off,
int len)
DataOutputwriteBytes in class DataOutputb - the bytes to writeoff - the offset in the byte arraylen - the number of bytes to writeDataInput.readBytes(byte[],int,int)public void writeString(java.lang.String string)
throws java.io.IOException
DataOutput
Writes strings as UTF-8 encoded bytes. First the length, in bytes, is
written as a VInt, followed by the bytes.
writeString in class DataOutputjava.io.IOExceptionDataInput.readString()public byte[] getBytes()
public int getPosition()
public void reset()