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
ConstructorsConstructorDescriptionSignatureStream(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 intGet 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, transferToMethods 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 benbytes of decompressed ASCII, but the codec may need to consume an entire encrypted GZIP block in order to inspect thosenbytes. 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.
-