loci.formats.codec

## Class BitWriter

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

- Deprecated.
  Use loci.common.RandomAccessOutputStream instead

      public class BitWriter
      extends java.lang.Object

  A class for writing arbitrary numbers of bits to a byte array.
  Author:
    Curtis Rueden ctrueden at wisc.edu

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private ome.codecs.BitWriter` | `writer` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BitWriter()` Deprecated. Constructs a new bit writer.
    `BitWriter(int size)` Deprecated. Constructs a new bit writer with the given initial buffer size.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) ome.codecs.BitWriter` | `getWrapped()` Deprecated.
    `static void` | `main(java.lang.String[] args)` Deprecated. Tests the BitWriter class.
    `byte[]` | `toByteArray()` Deprecated. Gets an array containing all bits written thus far.
    `void` | `write(int value, int numBits)` Deprecated. Writes the given value using the given number of bits.
    `void` | `write(java.lang.String bitString)` Deprecated. Writes the bits represented by a bit string to the buffer.

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

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

- - ### Field Detail

    - #### writer

          private ome.codecs.BitWriter writer

      Deprecated.

  - ### Constructor Detail

    - #### BitWriter

          public BitWriter()

      Deprecated.
      Constructs a new bit writer.

    - #### BitWriter

          public BitWriter(int size)

      Deprecated.
      Constructs a new bit writer with the given initial buffer size.

  - ### Method Detail

    - #### write

          public void write(int value,
                            int numBits)

      Deprecated.
      Writes the given value using the given number of bits.

    - #### write

          public void write(java.lang.String bitString)

      Deprecated.
      Writes the bits represented by a bit string to the buffer.
      Throws:
        `java.lang.IllegalArgumentException` - If any characters other than '0' and '1' appear in the string.

    - #### toByteArray

          public byte[] toByteArray()

      Deprecated.
      Gets an array containing all bits written thus far.

    - #### getWrapped

          ome.codecs.BitWriter getWrapped()

      Deprecated.

    - #### main

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

      Deprecated.
      Tests the BitWriter class.

Copyright © 2026 Open Microscopy Environment