Class BAMCodec
- All Implemented Interfaces:
HtsCodec<ReadsDecoderOptions,
,ReadsEncoderOptions> ReadsCodec
,Upgradeable
- Direct Known Subclasses:
BAMCodecV1_0
BundleResourceType.READS_BAM
codecs.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecodeURI
(IOPath ioPath) Determine if the URI forioPath
(obtained viaIOPath.getURI()
) conforms to the expected URI format this codec's file format.Get the name of the file format supported by this codec.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface htsjdk.beta.plugin.HtsCodec
canDecodeSignature, getDecoder, getDisplayName, getEncoder, getSignatureLength, getSignatureProbeLength, getVersion, ownsURI
Methods inherited from interface htsjdk.beta.plugin.reads.ReadsCodec
getContentType
Methods inherited from interface htsjdk.beta.plugin.Upgradeable
runVersionUpgrade
-
Field Details
-
BAM_DEFAULT_VERSION
-
-
Constructor Details
-
BAMCodec
public BAMCodec()
-
-
Method Details
-
getFileFormat
Description copied from interface:HtsCodec
Get the name of the file format supported by this codec. The format name defines the underlying format handled by this codec, and also corresponds to the format of the primary bundle resource that is required when decoding or encoding (seeBundleResourceType
andBundleResource.getFileFormat()
).- Specified by:
getFileFormat
in interfaceHtsCodec<ReadsDecoderOptions,
ReadsEncoderOptions> - Returns:
- the name of the underlying file format handled by this codec
-
canDecodeURI
Description copied from interface:HtsCodec
Determine if the URI forioPath
(obtained viaIOPath.getURI()
) conforms to the expected URI format this codec's file format. Most implementations only look at the file extension (seeIOPath.hasExtension(java.lang.String)
). For codecs that implement formats that use specific, well known file extensions, the codec should reject inputs that do not conform to any of the accepted extensions. If the format does not use a specific extension, or if the codec cannot determine if it can decode the underlying resource without inspecting the underlying stream, it is safe to return true, after which the framework will subsequently call this codec'sHtsCodec.canDecodeSignature(SignatureStream, String)
method, at which time the codec can inspect the actual underlying stream via theSignatureStream
.Implementations should generally not inspect the URI's protocol scheme unless the file format supported by the codec requires the use a specific protocol scheme. For codecs that do own a specific scheme or URI format, the return values for
HtsCodec.ownsURI(IOPath)
andHtsCodec.canDecodeURI(IOPath)
must always be the same (both true or both false) for a given IOPath. For codecs that do not use a custom URI (and rely on NIO access), @link #ownsURI(IOPath)} should always return false, with only the value returned fromHtsCodec.canDecodeURI(IOPath)
varying based on features such as file extension probes.It is never safe to attempt to directly inspect the underlying stream for
For custom URI handlers (seeioPath
in this method. If the stream needs to be inspected, it should be done using the signature stream when theHtsCodec.canDecodeSignature(SignatureStream, String)
method is called.HtsCodec.ownsURI(IOPath)
, codecs should avoid making remote calls to determine the suitability of the input resource; the return value for this method should be based only on the format of the URI that is presented. Since this method is used during codec resolution, implementations should avoid calling methods that may throw exceptions.- Specified by:
canDecodeURI
in interfaceHtsCodec<ReadsDecoderOptions,
ReadsEncoderOptions> - Parameters:
ioPath
- to be decoded- Returns:
- true if the codec can provide a decoder to provide this URI
-