Package com.clickhouse.data
Class ClickHouseByteUtils
java.lang.Object
com.clickhouse.data.ClickHouseByteUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetInt32LE(byte[] bytes, int offset) static longgetInt64LE(byte[] bytes, int offset) static intgetVarInt(ByteBuffer buffer) Gets varint from given byte buffer.static intgetVarIntSize(int value) Get varint length of given integer.static intgetVarLongSize(long value) Get varint length of given long.static intreadVarInt(InputStream input) Reads varint from given input stream.static voidsetInt32LE(byte[] bytes, int offset, int value) static voidsetInt64LE(byte[] bytes, int offset, long value) static voidsetVarInt(ByteBuffer buffer, int value) Write varint to given output stream.static voidwriteVarInt(OutputStream output, long value) Writes varint to given output stream.
-
Constructor Details
-
ClickHouseByteUtils
protected ClickHouseByteUtils()
-
-
Method Details
-
getInt32LE
public static int getInt32LE(byte[] bytes, int offset) -
setInt32LE
public static void setInt32LE(byte[] bytes, int offset, int value) -
getInt64LE
public static long getInt64LE(byte[] bytes, int offset) -
setInt64LE
public static void setInt64LE(byte[] bytes, int offset, long value) -
getVarIntSize
public static int getVarIntSize(int value) Get varint length of given integer.- Parameters:
value- integer- Returns:
- varint length
-
getVarLongSize
public static int getVarLongSize(long value) Get varint length of given long.- Parameters:
value- long- Returns:
- varint length
-
getVarInt
Gets varint from given byte buffer.- Parameters:
buffer- non-null byte buffer- Returns:
- varint
-
setVarInt
Write varint to given output stream.- Parameters:
buffer- non-null byte buffervalue- integer value
-
readVarInt
Reads varint from given input stream.- Parameters:
input- non-null input stream- Returns:
- varint
- Throws:
IOException- when failed to read value from input stream or reached end of the stream
-
writeVarInt
Writes varint to given output stream.- Parameters:
output- non-null output streamvalue- long value- Throws:
IOException- when failed to write value to output stream or reached end of the stream
-