public final class SerializationUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SerializationUtils.FixedBitSizes |
Constructor and Description |
---|
SerializationUtils() |
Modifier and Type | Method and Description |
---|---|
long |
bytesToLongBE(InStream input,
int n)
Read n bytes in big endian order and convert to long
|
static String |
bytesVectorToString(BytesColumnVector vector,
int elementNum)
Convert a bytes vector element into a String.
|
static long |
convertBetweenTimezones(TimeZone writer,
TimeZone reader,
long millis)
Find the relative offset when moving between timezones at a particular
point in time.
|
static double |
convertFromUtc(TimeZone local,
double time)
Convert a UTC time to a local timezone
|
static long |
convertFromUtc(TimeZone local,
long time) |
static long |
convertToUtc(TimeZone local,
long time) |
static int |
decodeBitWidth(int n)
Decodes the ordinal fixed bit value to actual fixed bit width value
|
int |
encodeBitWidth(int n)
Finds the closest available fixed bit width match and returns its encoded
value (ordinal).
|
int |
findClosestNumBits(long value)
Count the number of bits required to encode the given value
|
int |
getClosestAlignedFixedBits(int n) |
int |
getClosestFixedBits(int n)
For a given fixed bit this function will return the closest available fixed
bit
|
static StreamOptions |
getCustomizedCodec(StreamOptions base,
OrcFile.CompressionStrategy strategy,
OrcProto.Stream.Kind kind)
Get the stream options with the compression tuned for the particular
kind of stream.
|
boolean |
isSafeSubtract(long left,
long right) |
static Date |
parseDateFromString(String string)
Parse a date from a string.
|
int |
percentileBits(long[] data,
int offset,
int length,
double p)
Compute the bits required to represent pth percentile value
|
static BigInteger |
readBigInteger(InputStream input)
Read the signed arbitrary sized BigInteger BigInteger in vint format
|
double |
readDouble(InputStream in) |
float |
readFloat(InputStream in) |
void |
readInts(long[] buffer,
int offset,
int len,
int bitSize,
InStream input)
Read bitpacked integers from input stream
|
long |
readLongLE(InputStream in) |
static long |
readVslong(InputStream in) |
static long |
readVulong(InputStream in) |
void |
skipDouble(InputStream in,
int numOfDoubles) |
void |
skipFloat(InputStream in,
int numOfFloats) |
static void |
writeBigInteger(OutputStream output,
BigInteger value)
Write the arbitrarily sized signed BigInteger in vint format.
|
void |
writeDouble(OutputStream output,
double value) |
void |
writeFloat(OutputStream output,
float value) |
void |
writeInts(long[] input,
int offset,
int len,
int bitSize,
OutputStream output)
Bitpack and write the input values to underlying output stream
|
void |
writeVslong(OutputStream output,
long value) |
void |
writeVulong(OutputStream output,
long value) |
long |
zigzagDecode(long val)
zigzag decode the given value
|
long |
zigzagEncode(long val)
zigzag encode the given value
|
public void writeVulong(OutputStream output, long value) throws IOException
IOException
public void writeVslong(OutputStream output, long value) throws IOException
IOException
public static long readVulong(InputStream in) throws IOException
IOException
public static long readVslong(InputStream in) throws IOException
IOException
public float readFloat(InputStream in) throws IOException
IOException
public void skipFloat(InputStream in, int numOfFloats) throws IOException
IOException
public void writeFloat(OutputStream output, float value) throws IOException
IOException
public double readDouble(InputStream in) throws IOException
IOException
public long readLongLE(InputStream in) throws IOException
IOException
public void skipDouble(InputStream in, int numOfDoubles) throws IOException
IOException
public void writeDouble(OutputStream output, double value) throws IOException
IOException
public static void writeBigInteger(OutputStream output, BigInteger value) throws IOException
output
- the stream to write tovalue
- the value to outputIOException
public static BigInteger readBigInteger(InputStream input) throws IOException
input
- the stream to read fromIOException
public int findClosestNumBits(long value)
value
- public long zigzagEncode(long val)
val
- public long zigzagDecode(long val)
val
- public int percentileBits(long[] data, int offset, int length, double p)
data
- - arrayp
- - percentile value (>=0.0 to <=1.0)public long bytesToLongBE(InStream input, int n) throws IOException
IOException
public int getClosestFixedBits(int n)
n
- public int getClosestAlignedFixedBits(int n)
public int encodeBitWidth(int n)
n
- fixed bit width to encodepublic static int decodeBitWidth(int n)
n
- - encoded fixed bit widthpublic void writeInts(long[] input, int offset, int len, int bitSize, OutputStream output) throws IOException
input
- - values to writeoffset
- - offsetlen
- - lengthbitSize
- - bit widthoutput
- - output streamIOException
public void readInts(long[] buffer, int offset, int len, int bitSize, InStream input) throws IOException
buffer
- - input bufferoffset
- - offsetlen
- - lengthbitSize
- - bit widthinput
- - input streamIOException
public boolean isSafeSubtract(long left, long right)
public static double convertFromUtc(TimeZone local, double time)
local
- the local timezonetime
- the number of seconds since 1970public static long convertFromUtc(TimeZone local, long time)
public static long convertToUtc(TimeZone local, long time)
public static StreamOptions getCustomizedCodec(StreamOptions base, OrcFile.CompressionStrategy strategy, OrcProto.Stream.Kind kind)
base
- the original optionsstrategy
- the compression strategykind
- the stream kindpublic static long convertBetweenTimezones(TimeZone writer, TimeZone reader, long millis)
writer
- the timezone we are moving fromreader
- the timezone we are moving tomillis
- the point in timepublic static String bytesVectorToString(BytesColumnVector vector, int elementNum)
vector
- the vector to useelementNum
- the element number to stringifyCopyright © 2013–2023 The Apache Software Foundation. All rights reserved.