public static class UnsynchronizedBuffer.Writer extends Object
| Constructor and Description |
|---|
Writer()
Creates a new writer.
|
Writer(int initialCapacity)
Creates a new writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(boolean b)
Adds a Boolean value to this writer's buffer.
|
void |
add(byte[] bytes,
int off,
int length)
Adds bytes to this writer's buffer.
|
byte[] |
toArray()
Gets (a copy of) the contents of this writer's buffer.
|
ByteBuffer |
toByteBuffer()
Gets a
ByteBuffer wrapped around this writer's buffer. |
void |
writeVInt(int i)
Adds an integer value to this writer's buffer.
|
void |
writeVLong(long i)
Adds a long value to this writer's buffer.
|
public Writer()
public Writer(int initialCapacity)
initialCapacity - initial byte capacitypublic void add(byte[] bytes,
int off,
int length)
bytes - byte arrayoff - offset into array to start copying byteslength - number of bytes to addIndexOutOfBoundsException - if off or length are invalidpublic void add(boolean b)
b - Boolean valuepublic byte[] toArray()
public ByteBuffer toByteBuffer()
ByteBuffer wrapped around this writer's buffer.public void writeVInt(int i)
writeVLong(long) for a description of the encoding.i - integer valuepublic void writeVLong(long i)
WritableUtils.writeVLong()
in the Hadoop API. [link]i - long valueCopyright © 2016–2021 MWARE SOLUTIONS. All rights reserved.