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
|
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
|
boolean |
isSafeSubtract(long left,
long right) |
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) |
long |
readVslong(InputStream in) |
long |
readVulong(InputStream in) |
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 long readVulong(InputStream in) throws IOException
IOException
public long readVslong(InputStream in) throws IOException
IOException
public float readFloat(InputStream in) 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 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 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)
Copyright © 2016 The Apache Software Foundation. All rights reserved.