public final class LazyBinaryUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
LazyBinaryUtils.RecordInfo
Record is the unit that data is serialized in.
|
static class |
LazyBinaryUtils.VInt
A zero-compressed encoded integer.
|
static class |
LazyBinaryUtils.VLong
A zero-compressed encoded long.
|
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<LazyBinaryUtils.VInt> |
threadLocalVInt |
Modifier and Type | Method and Description |
---|---|
static int |
byteArrayToInt(byte[] b,
int offset)
Convert the byte array to an int starting from the given offset.
|
static long |
byteArrayToLong(byte[] b,
int offset)
Convert the byte array to a long starting from the given offset.
|
static short |
byteArrayToShort(byte[] b,
int offset)
Convert the byte array to a short starting from the given offset.
|
static void |
checkObjectByteInfo(ObjectInspector objectInspector,
byte[] bytes,
int offset,
LazyBinaryUtils.RecordInfo recordInfo,
LazyBinaryUtils.VInt vInt)
Check a particular field and set its size and offset in bytes based on the
field type and the bytes arrays.
|
static ObjectInspector |
getLazyBinaryObjectInspectorFromTypeInfo(TypeInfo typeInfo)
Returns the lazy binary object inspector that can be used to inspect an
lazy binary object of that typeInfo
For primitive types, we use the standard writable object inspector.
|
static void |
readVInt(byte[] bytes,
int offset,
LazyBinaryUtils.VInt vInt)
Reads a zero-compressed encoded int from a byte array and returns it.
|
static void |
readVLong(byte[] bytes,
int offset,
LazyBinaryUtils.VLong vlong)
Reads a zero-compressed encoded long from a byte array and returns it.
|
static long |
readVLongFromByteArray(byte[] bytes,
int offset)
Read a zero-compressed encoded long from a byte array.
|
static void |
writeDouble(ByteStream.RandomAccessOutput byteStream,
double d) |
static void |
writeVInt(ByteStream.RandomAccessOutput byteStream,
int i)
Writes a zero-compressed encoded int to a byte array.
|
static void |
writeVLong(ByteStream.RandomAccessOutput byteStream,
long l) |
static int |
writeVLongToByteArray(byte[] bytes,
int offset,
long l) |
static int |
writeVLongToByteArray(byte[] bytes,
long l)
Write a zero-compressed encoded long to a byte array.
|
public static final ThreadLocal<LazyBinaryUtils.VInt> threadLocalVInt
public static int byteArrayToInt(byte[] b, int offset)
b
- the byte arrayoffset
- the array offsetpublic static long byteArrayToLong(byte[] b, int offset)
b
- the byte arrayoffset
- the array offsetpublic static short byteArrayToShort(byte[] b, int offset)
b
- the byte arrayoffset
- the array offsetpublic static void checkObjectByteInfo(ObjectInspector objectInspector, byte[] bytes, int offset, LazyBinaryUtils.RecordInfo recordInfo, LazyBinaryUtils.VInt vInt)
objectInspector
- object inspector of the fieldbytes
- bytes arrays store the table rowoffset
- offset of this fieldrecordInfo
- modify this byteinfo object and return itpublic static void readVLong(byte[] bytes, int offset, LazyBinaryUtils.VLong vlong)
bytes
- the byte arrayoffset
- offset of the array to read fromvlong
- storing the deserialized long and its size in bytepublic static void readVInt(byte[] bytes, int offset, LazyBinaryUtils.VInt vInt)
bytes
- the byte arrayoffset
- offset of the array to read fromvInt
- storing the deserialized int and its size in bytepublic static void writeVInt(ByteStream.RandomAccessOutput byteStream, int i)
byteStream
- the byte array/streami
- the intpublic static long readVLongFromByteArray(byte[] bytes, int offset)
bytes
- the byte arrayoffset
- the offset in the byte array where the VLong is storedpublic static int writeVLongToByteArray(byte[] bytes, long l)
bytes
- the byte array/streaml
- the longpublic static int writeVLongToByteArray(byte[] bytes, int offset, long l)
public static void writeVLong(ByteStream.RandomAccessOutput byteStream, long l)
public static void writeDouble(ByteStream.RandomAccessOutput byteStream, double d)
public static ObjectInspector getLazyBinaryObjectInspectorFromTypeInfo(TypeInfo typeInfo)
Copyright © 2017 The Apache Software Foundation. All rights reserved.