Package htsjdk.beta.io.bundle
Class SignatureStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
htsjdk.beta.io.bundle.SignatureStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
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 java.io.ByteArrayInputStream
buf, count, mark, pos
-
Constructor Summary
ConstructorDescriptionSignatureStream
(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 TypeMethodDescriptionfinal int
Get the maximum number of bytes that can be consumed from this stream.Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
Methods inherited from class java.io.InputStream
nullInputStream, read, readNBytes, skipNBytes
-
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 ben
bytes of decompressed ASCII, but the codec may need to consume an entire encrypted GZIP block in order to inspect thosen
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.
-