Class ClickHouseByteUtils

java.lang.Object
com.clickhouse.data.ClickHouseByteUtils

public class ClickHouseByteUtils extends Object
  • 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

      public static int getVarInt(ByteBuffer buffer)
      Gets varint from given byte buffer.
      Parameters:
      buffer - non-null byte buffer
      Returns:
      varint
    • setVarInt

      public static void setVarInt(ByteBuffer buffer, int value)
      Write varint to given output stream.
      Parameters:
      buffer - non-null byte buffer
      value - integer value
    • readVarInt

      public static int readVarInt(InputStream input) throws IOException
      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

      public static void writeVarInt(OutputStream output, long value) throws IOException
      Writes varint to given output stream.
      Parameters:
      output - non-null output stream
      value - long value
      Throws:
      IOException - when failed to write value to output stream or reached end of the stream