public static class UnsynchronizedBuffer.Writer extends Object
Constructor and Description |
---|
UnsynchronizedBuffer.Writer()
Creates a new writer.
|
UnsynchronizedBuffer.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 UnsynchronizedBuffer.Writer()
public UnsynchronizedBuffer.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 © 2011–2016 The Apache Software Foundation. All rights reserved.