com.hazelcast.nio

## Class Bits

- java.lang.Object
- - com.hazelcast.nio.Bits

-     @PrivateApi
      public final class Bits
      extends Object

  Access and manipulate bits, bytes, primitives...

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BOOLEAN_SIZE_IN_BYTES` Boolean size in bytes
    `static int` | `BYTE_SIZE_IN_BYTES` Byte size in bytes
    `static int` | `CACHE_LINE_LENGTH` Length of the data blocks used by the CPU cache sub-system in bytes.
    `static int` | `CHAR_SIZE_IN_BYTES` Char size in bytes
    `static int` | `DOUBLE_SIZE_IN_BYTES` Double size in bytes
    `static int` | `FLOAT_SIZE_IN_BYTES` Float size in bytes
    `static int` | `INT_SIZE_IN_BYTES` Integer size in bytes
    `static Charset` | `ISO_8859_1` A reusable instance of the ISO Latin-1 charset
    `static int` | `LONG_SIZE_IN_BYTES` Long size in bytes
    `static int` | `NULL_ARRAY_LENGTH` for null arrays, this value is written to the stream to represent null array size.
    `static int` | `SHORT_SIZE_IN_BYTES` Short size in bytes
    `static Charset` | `UTF_8` A reusable instance of the UTF-8 charset

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte` | `clearBit(byte value, int bit)` Clears n-th bit of the byte value
    `static int` | `clearBit(int value, int bit)` Clears n-th bit of the integer value
    `static int` | `combineToInt(short x, short y)` Combines two short integer values into an integer.
    `static long` | `combineToLong(int x, int y)` Combines two integer values into a long integer.
    `static int` | `extractInt(long value, boolean lowerBits)`
    `static short` | `extractShort(int value, boolean lowerBits)`
    `static byte` | `invertBit(byte value, int bit)` Inverts n-th bit of the byte value
    `static int` | `invertBit(int value, int bit)` Inverts n-th bit of the integer value
    `static boolean` | `isBitSet(int value, int bit)` Returns true if n-th bit of the value is set, false otherwise
    `static char` | `readChar(byte[] buffer, int pos, boolean useBigEndian)`
    `static char` | `readCharB(byte[] buffer, int pos)`
    `static char` | `readCharL(byte[] buffer, int pos)`
    `static int` | `readInt(byte[] buffer, int pos, boolean useBigEndian)`
    `static int` | `readIntB(byte[] buffer, int pos)`
    `static int` | `readIntL(byte[] buffer, int pos)`
    `static int` | `readIntL(ByteBuffer buffer)`
    `static long` | `readLong(byte[] buffer, int pos, boolean useBigEndian)`
    `static long` | `readLongB(byte[] buffer, int pos)`
    `static long` | `readLongL(byte[] buffer, int pos)`
    `static short` | `readShort(byte[] buffer, int pos, boolean useBigEndian)`
    `static short` | `readShortB(byte[] buffer, int pos)`
    `static short` | `readShortL(byte[] buffer, int pos)`
    `static int` | `readUtf8Char(byte[] buffer, int pos, char[] dst, int dstPos)`
    `static char` | `readUtf8Char(DataInput in, byte firstByte)`
    `static byte` | `setBit(byte value, int bit)` Sets n-th bit of the byte value
    `static int` | `setBit(int value, int bit)` Sets n-th bit of the integer value
    `static void` | `writeChar(byte[] buffer, int pos, char v, boolean useBigEndian)`
    `static void` | `writeCharB(byte[] buffer, int pos, char v)`
    `static void` | `writeCharL(byte[] buffer, int pos, char v)`
    `static void` | `writeInt(byte[] buffer, int pos, int v, boolean useBigEndian)`
    `static void` | `writeIntB(byte[] buffer, int pos, int v)`
    `static void` | `writeIntL(byte[] buffer, int pos, int v)`
    `static void` | `writeLong(byte[] buffer, int pos, long v, boolean useBigEndian)`
    `static void` | `writeLongB(byte[] buffer, int pos, long v)`
    `static void` | `writeLongL(byte[] buffer, int pos, long v)`
    `static void` | `writeShort(byte[] buffer, int pos, short v, boolean useBigEndian)`
    `static void` | `writeShortB(byte[] buffer, int pos, short v)`
    `static void` | `writeShortL(byte[] buffer, int pos, short v)`
    `static int` | `writeUtf8Char(byte[] buffer, int pos, int c)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### BYTE_SIZE_IN_BYTES

          public static final int BYTE_SIZE_IN_BYTES

      Byte size in bytes
      See Also:
        Constant Field Values

    - #### BOOLEAN_SIZE_IN_BYTES

          public static final int BOOLEAN_SIZE_IN_BYTES

      Boolean size in bytes
      See Also:
        Constant Field Values

    - #### SHORT_SIZE_IN_BYTES

          public static final int SHORT_SIZE_IN_BYTES

      Short size in bytes
      See Also:
        Constant Field Values

    - #### CHAR_SIZE_IN_BYTES

          public static final int CHAR_SIZE_IN_BYTES

      Char size in bytes
      See Also:
        Constant Field Values

    - #### INT_SIZE_IN_BYTES

          public static final int INT_SIZE_IN_BYTES

      Integer size in bytes
      See Also:
        Constant Field Values

    - #### FLOAT_SIZE_IN_BYTES

          public static final int FLOAT_SIZE_IN_BYTES

      Float size in bytes
      See Also:
        Constant Field Values

    - #### LONG_SIZE_IN_BYTES

          public static final int LONG_SIZE_IN_BYTES

      Long size in bytes
      See Also:
        Constant Field Values

    - #### DOUBLE_SIZE_IN_BYTES

          public static final int DOUBLE_SIZE_IN_BYTES

      Double size in bytes
      See Also:
        Constant Field Values

    - #### NULL_ARRAY_LENGTH

          public static final int NULL_ARRAY_LENGTH

      for null arrays, this value is written to the stream to represent null array size.
      See Also:
        Constant Field Values

    - #### CACHE_LINE_LENGTH

          public static final int CACHE_LINE_LENGTH

      Length of the data blocks used by the CPU cache sub-system in bytes.
      See Also:
        Constant Field Values

    - #### UTF_8

          public static final Charset UTF_8

      A reusable instance of the UTF-8 charset

    - #### ISO_8859_1

          public static final Charset ISO_8859_1

      A reusable instance of the ISO Latin-1 charset

  - ### Method Detail

    - #### readChar

          public static char readChar(byte[] buffer,
                                      int pos,
                                      boolean useBigEndian)

    - #### readCharB

          public static char readCharB(byte[] buffer,
                                       int pos)

    - #### readCharL

          public static char readCharL(byte[] buffer,
                                       int pos)

    - #### writeChar

          public static void writeChar(byte[] buffer,
                                       int pos,
                                       char v,
                                       boolean useBigEndian)

    - #### writeCharB

          public static void writeCharB(byte[] buffer,
                                        int pos,
                                        char v)

    - #### writeCharL

          public static void writeCharL(byte[] buffer,
                                        int pos,
                                        char v)

    - #### readShort

          public static short readShort(byte[] buffer,
                                        int pos,
                                        boolean useBigEndian)

    - #### readShortB

          public static short readShortB(byte[] buffer,
                                         int pos)

    - #### readShortL

          public static short readShortL(byte[] buffer,
                                         int pos)

    - #### writeShort

          public static void writeShort(byte[] buffer,
                                        int pos,
                                        short v,
                                        boolean useBigEndian)

    - #### writeShortB

          public static void writeShortB(byte[] buffer,
                                         int pos,
                                         short v)

    - #### writeShortL

          public static void writeShortL(byte[] buffer,
                                         int pos,
                                         short v)

    - #### readInt

          public static int readInt(byte[] buffer,
                                    int pos,
                                    boolean useBigEndian)

    - #### readIntB

          public static int readIntB(byte[] buffer,
                                     int pos)

    - #### readIntL

          public static int readIntL(byte[] buffer,
                                     int pos)

    - #### readIntL

          public static int readIntL(ByteBuffer buffer)

    - #### writeInt

          public static void writeInt(byte[] buffer,
                                      int pos,
                                      int v,
                                      boolean useBigEndian)

    - #### writeIntB

          public static void writeIntB(byte[] buffer,
                                       int pos,
                                       int v)

    - #### writeIntL

          public static void writeIntL(byte[] buffer,
                                       int pos,
                                       int v)

    - #### readLong

          public static long readLong(byte[] buffer,
                                      int pos,
                                      boolean useBigEndian)

    - #### readLongB

          public static long readLongB(byte[] buffer,
                                       int pos)

    - #### readLongL

          public static long readLongL(byte[] buffer,
                                       int pos)

    - #### writeLong

          public static void writeLong(byte[] buffer,
                                       int pos,
                                       long v,
                                       boolean useBigEndian)

    - #### writeLongB

          public static void writeLongB(byte[] buffer,
                                        int pos,
                                        long v)

    - #### writeLongL

          public static void writeLongL(byte[] buffer,
                                        int pos,
                                        long v)

    - #### writeUtf8Char

          public static int writeUtf8Char(byte[] buffer,
                                          int pos,
                                          int c)

    - #### readUtf8Char

          public static int readUtf8Char(byte[] buffer,
                                         int pos,
                                         char[] dst,
                                         int dstPos)
                                  throws IOException

      Throws:
        `IOException`

    - #### readUtf8Char

          public static char readUtf8Char(DataInput in,
                                          byte firstByte)
                                   throws IOException

      Throws:
        `IOException`

    - #### setBit

          public static byte setBit(byte value,
                                    int bit)

      Sets n-th bit of the byte value
      Parameters:
        `value` - byte value
        `bit` - n-th bit
      Returns:
        value

    - #### clearBit

          public static byte clearBit(byte value,
                                      int bit)

      Clears n-th bit of the byte value
      Parameters:
        `value` - byte value
        `bit` - n-th bit
      Returns:
        value

    - #### invertBit

          public static byte invertBit(byte value,
                                       int bit)

      Inverts n-th bit of the byte value
      Parameters:
        `value` - byte value
        `bit` - n-th bit
      Returns:
        value

    - #### setBit

          public static int setBit(int value,
                                   int bit)

      Sets n-th bit of the integer value
      Parameters:
        `value` - integer value
        `bit` - n-th bit
      Returns:
        value

    - #### clearBit

          public static int clearBit(int value,
                                     int bit)

      Clears n-th bit of the integer value
      Parameters:
        `value` - integer value
        `bit` - n-th bit
      Returns:
        value

    - #### invertBit

          public static int invertBit(int value,
                                      int bit)

      Inverts n-th bit of the integer value
      Parameters:
        `value` - integer value
        `bit` - n-th bit
      Returns:
        value

    - #### isBitSet

          public static boolean isBitSet(int value,
                                         int bit)

      Returns true if n-th bit of the value is set, false otherwise

    - #### combineToInt

          public static int combineToInt(short x,
                                         short y)

      Combines two short integer values into an integer.

    - #### extractShort

          public static short extractShort(int value,
                                           boolean lowerBits)

    - #### combineToLong

          public static long combineToLong(int x,
                                           int y)

      Combines two integer values into a long integer.

    - #### extractInt

          public static int extractInt(long value,
                                       boolean lowerBits)

Copyright © 2019. All rights reserved.