# Class LTF8

java.lang.Object
htsjdk.samtools.cram.io.LTF8

public class LTF8 extends Object
Methods to read and write LTF8 as per CRAM specs. LTF8 encodes longs as 1 to 9 bytes depending on the highest set bit. See `ITF8` for more details.

## Constructor Summary

Constructors
Constructor
Description
`LTF8()`

## Method Summary

Modifier and Type
Method
Description
`static long`
`readUnsignedLTF8(CRAMByteReader reader)`
Reads an unsigned LTF8 long from a `CRAMByteReader`.
`static long`
`readUnsignedLTF8(InputStream inputStream)`
Reads an unsigned long value from the input stream.
`static int`
`writeUnsignedLTF8(long value, CRAMByteWriter writer)`
Writes an unsigned LTF8 long to a `CRAMByteWriter`.
`static int`
`writeUnsignedLTF8(long value, OutputStream outputStream)`
Writes an unsigned long value to the output stream.

### Methods inherited from class Object

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

## Constructor Details

### LTF8

public LTF8()

## Method Details

### readUnsignedLTF8

public static long readUnsignedLTF8(InputStream inputStream)
Reads an unsigned long value from the input stream. The sign bit should be interpreted just as other bits in the value.

Parameters:
  `inputStream` - input stream to be read from
Returns:
  value encoded in the stream as LTF8

### readUnsignedLTF8

public static long readUnsignedLTF8(CRAMByteReader reader)
Reads an unsigned LTF8 long from a `CRAMByteReader`. Equivalent to the InputStream version but avoids synchronized method call overhead.

Parameters:
  `reader` - the reader to read from
Returns:
  the decoded value

### writeUnsignedLTF8

public static int writeUnsignedLTF8(long value, CRAMByteWriter writer)
Writes an unsigned LTF8 long to a `CRAMByteWriter`. Equivalent to the OutputStream version but avoids synchronized method call overhead.

Parameters:
  `value` - the value to write
  `writer` - the writer to write to
Returns:
  number of bits written

### writeUnsignedLTF8

public static int writeUnsignedLTF8(long value, OutputStream outputStream)
Writes an unsigned long value to the output stream. The sign bit is interpreted just as other bits in the value.

Parameters:
  `value` - the value to be written
  `outputStream` - the output stream to write to
Returns:
  the number of bits written