## loci.formats
Class BitWriter

    java.lang.Object
      loci.formats.BitWriter

public class BitWriter
extends Object

A class for writing arbitrary numbers of bits to a byte array.

Constructor Summary
`BitWriter()` Constructs a new bit writer.
`BitWriter(int size)` Constructs a new bit writer with the given initial buffer size.

Method Summary
`static void` `main(String[] args)` Tests the BitWriter class.
`byte[]` `toByteArray()` Gets an array containing all bits written thus far.
`void` `write(int value, int numBits)` Writes the given value using the given number of bits.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BitWriter

    public BitWriter()

  Constructs a new bit writer.

### BitWriter

    public BitWriter(int size)

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

Method Detail

### write

    public void write(int value,
                      int numBits)

  Writes the given value using the given number of bits.

### toByteArray

    public byte[] toByteArray()

  Gets an array containing all bits written thus far.

### main

    public static void main(String[] args)

  Tests the BitWriter class.