Package htsjdk.samtools.cram.io

# Class DefaultBitOutputStream

java.lang.Object
java.io.OutputStream
htsjdk.samtools.cram.io.DefaultBitOutputStream

All Implemented Interfaces:
  `BitOutputStream`, `Closeable`, `Flushable`, `AutoCloseable`

public class DefaultBitOutputStream extends OutputStream implements BitOutputStream

## Constructor Summary

Constructors
Constructor
Description
`DefaultBitOutputStream(OutputStream delegate)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`void`
`flush()`
`String`
`toString()`
`void`
`write(boolean bit)`
Write a single bit specified in the boolean argument.
`void`
`write(boolean bit, long repeat)`
Write a single bit specified in the boolean argument repeatedly.
`void`
`write(byte b)`
`void`
`write(byte[] b)`
`void`
`write(byte[] b, int off, int length)`
`void`
`write(byte bitContainer, int nofBits)`
Write specified number of bits supplied in the byte value.
`void`
`write(int value)`
`void`
`write(int bitContainer, int nofBits)`
Write specified number of bits supplied in the integer value.
`void`
`write(long bitContainer, int nofBits)`
Write specified number of bits supplied in the long value.

### Methods inherited from class java.io.OutputStream

`nullOutputStream`

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

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

## Constructor Details

### DefaultBitOutputStream

public DefaultBitOutputStream(OutputStream delegate)

## Method Details

### write

public void write(byte b)

### write

public void write(int value)

Specified by:
  `write` in class `OutputStream`

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### write

public void write(long bitContainer, int nofBits)
Description copied from interface: `BitOutputStream`
Write specified number of bits supplied in the long value. The method is naturally limited to 64 bits max.

Specified by:
  `write` in interface `BitOutputStream`
Parameters:
  `bitContainer` - an integer containing the bits to be written out
  `nofBits` - the number of bits to written out, minimum 0, maximum 64.

### write

public void write(int bitContainer, int nofBits)
Description copied from interface: `BitOutputStream`
Write specified number of bits supplied in the integer value. The method is naturally limited to 32 bits max.

Specified by:
  `write` in interface `BitOutputStream`
Parameters:
  `bitContainer` - an integer containing the bits to be written out
  `nofBits` - the number of bits to written out, minimum 0, maximum 32.

### write

public void write(byte bitContainer, int nofBits)
Description copied from interface: `BitOutputStream`
Write specified number of bits supplied in the byte value. The method is naturally limited to 8 bits max.

Specified by:
  `write` in interface `BitOutputStream`
Parameters:
  `bitContainer` - an integer containing the bits to be written out
  `nofBits` - the number of bits to written out, minimum 0, maximum 8.

### write

public void write(boolean bit)
Description copied from interface: `BitOutputStream`
Write a single bit specified in the boolean argument.

Specified by:
  `write` in interface `BitOutputStream`
Parameters:
  `bit` - emit 1 if true, 0 otherwise.

### write

public void write(boolean bit, long repeat)
Description copied from interface: `BitOutputStream`
Write a single bit specified in the boolean argument repeatedly.

Specified by:
  `write` in interface `BitOutputStream`
Parameters:
  `bit` - emit 1 if true, 0 otherwise.
  `repeat` - the number of bits to emit.

### close

public void close()

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `OutputStream`

### flush

public void flush()

Specified by:
  `flush` in interface `Flushable`
Overrides:
  `flush` in class `OutputStream`

### write

public void write(byte[] b)

Overrides:
  `write` in class `OutputStream`

### write

public void write(byte[] b, int off, int length)

Overrides:
  `write` in class `OutputStream`