public class UnsynchronizedBuffer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
UnsynchronizedBuffer.Reader
A byte buffer reader.
|
static class |
UnsynchronizedBuffer.Writer
A byte buffer writer.
|
Constructor and Description |
---|
UnsynchronizedBuffer() |
Modifier and Type | Method and Description |
---|---|
static int |
nextArraySize(int i)
Determines what next array size should be by rounding up to next power of two.
|
static int |
writeVInt(byte[] dest,
int offset,
int i)
Writes a variable int directly to a byte array.
|
static void |
writeVInt(DataOutput out,
byte[] workBuffer,
int i)
Use the provided byte[] to buffer only the bytes used to write out the integer i to the
DataOutput out.
|
static int |
writeVLong(byte[] dest,
int offset,
long value)
Writes a variable long directly to a byte array.
|
static void |
writeVLong(DataOutput out,
byte[] workBuffer,
long i)
Use the provided byte[] to buffer only the bytes used to write out the long i to the DataOutput
out.
|
public static int nextArraySize(int i)
i
- current array sizeIllegalArgumentException
- if i is negativepublic static void writeVInt(DataOutput out, byte[] workBuffer, int i) throws IOException
WritableUtils.writeVInt(DataOutput, int)
which could make up to 4 separate writes to
the underlying OutputStream. Is compatible with WritableUtils as it will write the same data.IOException
public static void writeVLong(DataOutput out, byte[] workBuffer, long i) throws IOException
WritableUtils.writeVLong(DataOutput, long)
which could make up to 8 separate writes to
the underlying OutputStream. Is compatible with WritableUtils as it will write the same data.IOException
public static int writeVInt(byte[] dest, int offset, int i)
WritableUtils
as it
will write the same data.public static int writeVLong(byte[] dest, int offset, long value)
WritableUtils
as it
will write the same data.dest
- The destination array for the long to be written tooffset
- The location where to write the long tovalue
- The long value being written into byte arrayCopyright © 2011–2019 The Apache Software Foundation. All rights reserved.