# Class DefaultBitInputStream

java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
htsjdk.samtools.cram.io.DefaultBitInputStream

All Implemented Interfaces:
  `BitInputStream, Closeable, DataInput, AutoCloseable`

public class DefaultBitInputStream extends DataInputStream implements BitInputStream
Must not read from delegate unless no bits left in the buffer!!!

## Field Summary

### Fields inherited from class FilterInputStream

`in`

## Constructor Summary

Constructors
Constructor
Description
`DefaultBitInputStream(InputStream in)`

## Method Summary

Modifier and Type
Method
Description
`final boolean`
`readBit()`
Reads a single bit from the stream.
`final int`
`readBits(int n)`
Read specified number of bits from the stream.
`final long`
`readLongBits(int n)`
Read specified number of bits from the stream.
`void`
`reset()`

### Methods inherited from class DataInputStream

`read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes`

### Methods inherited from class FilterInputStream

`available, close, mark, markSupported, read, skip`

### Methods inherited from class InputStream

`nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo`

### Methods inherited from class Object

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

### Methods inherited from interface Closeable

`close`

## Constructor Details

### DefaultBitInputStream

public DefaultBitInputStream(InputStream in)

## Method Details

### readBit

public final boolean readBit()
Description copied from interface: `BitInputStream`
Reads a single bit from the stream.

Specified by:
  `readBit` in interface `BitInputStream`

### readBits

public final int readBits(int n)
Description copied from interface: `BitInputStream`
Read specified number of bits from the stream. The bits are return in an integer value.

Specified by:
  `readBits` in interface `BitInputStream`
Parameters:
  `n` - number of bits to read

### readLongBits

public final long readLongBits(int n)
Description copied from interface: `BitInputStream`
Read specified number of bits from the stream. The bits are return in a long value.

Specified by:
  `readLongBits` in interface `BitInputStream`
Parameters:
  `n` - number of bits to read

### reset

public void reset()

Overrides:
  `reset` in class `FilterInputStream`