# Class SignatureStream

java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
htsjdk.beta.io.bundle.SignatureStream

All Implemented Interfaces:
  `Closeable, AutoCloseable`

public final class SignatureStream extends ByteArrayInputStream
An input stream over the first `signaturePrefixLength` bytes of another input stream, used to allow multiple codecs to probe those bytes for a file format/version signature.

## Field Summary

### Fields inherited from class ByteArrayInputStream

`buf, count, mark, pos`

## Constructor Summary

Constructors
Constructor
Description
`SignatureStream(int signaturePrefixLength, byte[] signaturePrefix)`
Create a signature probe stream containing the first signaturePrefixLength bytes of an input stream that can be probed for a signature.

## Method Summary

Modifier and Type
Method
Description
`final int`
`getSignaturePrefixLength()`
Get the maximum number of bytes that can be consumed from this stream.

### Methods inherited from class ByteArrayInputStream

`available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo`

### Methods inherited from class InputStream

`nullInputStream, read, readNBytes, skipNBytes`

### Methods inherited from class Object

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

## Constructor Details

### SignatureStream

public SignatureStream(int signaturePrefixLength, byte[] signaturePrefix)
Create a signature probe stream containing the first signaturePrefixLength bytes of an input stream that can be probed for a signature.

Parameters:
  `signaturePrefixLength` - signaturePrefixLength should be expressed in "compressed(/encrypted)" space rather than "plaintext" space. For example, a raw signature may be `n` bytes of decompressed ASCII, but the codec may need to consume an entire encrypted GZIP block in order to inspect those `n` bytes. signaturePrefixLength should be specified based on the block size, in order to ensure that the signature probe stream contains a semantically meaningful fragment of the underlying input.
  `signaturePrefix` - the bytes containing the signature, over which the probe stream will be created

## Method Details

### getSignaturePrefixLength

public final int getSignaturePrefixLength()
Get the maximum number of bytes that can be consumed from this stream.

Returns:
  the maximum number of bytes that can be consumed from this stream.