loci.formats.codec

## Class BitBuffer

- java.lang.Object
- - loci.formats.codec.BitBuffer

- Deprecated.
  Use loci.common.RandomAccessInputStream instead

      public class BitBuffer
      extends java.lang.Object

  A class for reading arbitrary numbers of bits from a byte array.
  Author:
    Eric Kjellman egkjellman at wisc.edu

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private ome.codecs.BitBuffer` | `buffer` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BitBuffer(byte[] byteBuffer)` Deprecated. Default constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBits(int bitsToRead)` Deprecated. Returns an int value representing the value of the bits read from the byte array, from the current position.
    `byte[]` | `getByteBuffer()` Deprecated. Return the backing byte array.
    `(package private) ome.codecs.BitBuffer` | `getWrapped()` Deprecated.
    `boolean` | `isBitOnByteBoundary()` Deprecated. Checks if the current position is on a byte boundary, that is the next bit in the byte array is the first bit in a byte.
    `static void` | `main(java.lang.String[] args)` Deprecated. Testing method.
    `void` | `skipBits(long bits)` Deprecated. Skips a number of bits in the BitBuffer.

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

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

- - ### Field Detail

    - #### buffer

          private ome.codecs.BitBuffer buffer

      Deprecated.

  - ### Constructor Detail

    - #### BitBuffer

          public BitBuffer(byte[] byteBuffer)

      Deprecated.
      Default constructor.

  - ### Method Detail

    - #### getByteBuffer

          public byte[] getByteBuffer()

      Deprecated.
      Return the backing byte array.

    - #### skipBits

          public void skipBits(long bits)

      Deprecated.
      Skips a number of bits in the BitBuffer.
      Parameters:
        `bits` - Number of bits to skip

    - #### getBits

          public int getBits(int bitsToRead)

      Deprecated.
      Returns an int value representing the value of the bits read from the byte array, from the current position. Bits are extracted from the "left side" or high side of the byte.

      The current position is modified by this call.

      Bits are pushed into the int from the right, endianness is not considered by the method on its own. So, if 5 bits were read from the buffer "10101", the int would be the integer representation of 000...0010101 on the target machine.

      In general, this also means the result will be positive unless a full 32 bits are read.

      Requesting more than 32 bits is allowed, but only up to 32 bits worth of data will be returned (the last 32 bits read).

      Parameters:
        `bitsToRead` - the number of bits to read from the bit buffer
      Returns:
        the value of the bits read

    - #### isBitOnByteBoundary

          public boolean isBitOnByteBoundary()

      Deprecated.
      Checks if the current position is on a byte boundary, that is the next bit in the byte array is the first bit in a byte.
      Returns:
        true if bit is on byte boundary, false otherwise.

    - #### getWrapped

          ome.codecs.BitBuffer getWrapped()

      Deprecated.

    - #### main

          public static void main(java.lang.String[] args)

      Deprecated.
      Testing method.
      Parameters:
        `args` - Ignored.

Copyright © 2026 Open Microscopy Environment