Package htsjdk.beta.io.bundle
Class BundleResourceBase
java.lang.Object
htsjdk.beta.io.bundle.BundleResourceBase
- All Implemented Interfaces:
BundleResource,Serializable
- Direct Known Subclasses:
InputStreamResource,IOPathResource,OutputStreamResource
Base class for
BundleResource implementations.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBundleResourceBase(String displayName, String contentType, String format) Base constructor for creating a new bundle resource. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the content type for this resource.Get the display name for this resource.Get the file format for this resource.Get anInputStreamfor this resource, or Optional.empty.Get theIOPathbacking this resource, or Optional.empty.Get anOutputStreamfor this resource, or Optional.empty.Get aSeekableStreamfor this resource, or Optional.empty.inthashCode()booleanReturn true if is this resource is backed by a type that can be used for input.booleanReturn true if this resource is backed by a type that can be used for output.booleanReturns true if this resource can be rendered as aSeekableStream.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface htsjdk.beta.io.bundle.BundleResource
getSignatureStream
-
Constructor Details
-
BundleResourceBase
Base constructor for creating a new bundle resource.- Parameters:
displayName- A user-recognizable name for this resource. Used for error messages. May not be null or 0 length.contentType- The content type for this resource. Can be any string, but it must be unique within a given bundle. May not be null or zero length.format- The (optional) format for this resource. Can be any string, i.e, "BAM" for a resource with content type "READS". Predefined format strings are defined inBundleResourceType.
-
-
Method Details
-
getDisplayName
Description copied from interface:BundleResourceGet the display name for this resource.- Specified by:
getDisplayNamein interfaceBundleResource- Returns:
- the display name for this resource
-
getContentType
Description copied from interface:BundleResourceGet the content type for this resource.- Specified by:
getContentTypein interfaceBundleResource- Returns:
- a string representing name of the content type for this resource
-
getFileFormat
Description copied from interface:BundleResourceGet the file format for this resource.- Specified by:
getFileFormatin interfaceBundleResource- Returns:
- the file format for this resource, or Optional.empty if not present
-
getIOPath
Description copied from interface:BundleResourceGet theIOPathbacking this resource, or Optional.empty.- Specified by:
getIOPathin interfaceBundleResource- Returns:
- the
IOPathbacking this resource, or Optional.empty if the resource has no backingIOPath
-
getInputStream
Description copied from interface:BundleResourceGet anInputStreamfor this resource, or Optional.empty.- Specified by:
getInputStreamin interfaceBundleResource- Returns:
- an
InputStreamfor this resource, or Optional.empty ifBundleResource.hasInputType()is false for this resource. The stream returned by this method may be buffered or use read-ahead, which may not be suitable for applications such as index creation that need control over the position of the underlying stream.
-
getOutputStream
Description copied from interface:BundleResourceGet anOutputStreamfor this resource, or Optional.empty.- Specified by:
getOutputStreamin interfaceBundleResource- Returns:
- an
OutputStreamfor this resource, or Optional.empty ifBundleResource.hasOutputType()is false for this resource
-
getSeekableStream
Description copied from interface:BundleResourceGet aSeekableStreamfor this resource, or Optional.empty.- Specified by:
getSeekableStreamin interfaceBundleResource- Returns:
- an
SeekableStreamfor this resource, or Optional.empty if this is not an input type (seeBundleResource.hasInputType()), or is an input type for which noSeekableStreamcan be obtained (seeBundleResource.hasSeekableStream()).
-
hasSeekableStream
public boolean hasSeekableStream()Description copied from interface:BundleResourceReturns true if this resource can be rendered as aSeekableStream.- Specified by:
hasSeekableStreamin interfaceBundleResource- Returns:
- true if this resource can be rendered as a
SeekableStream(seeBundleResource.getSeekableStream())
-
hasInputType
public boolean hasInputType()Description copied from interface:BundleResourceReturn true if is this resource is backed by a type that can be used for input. Some resource types, such asInputStreamResource, can be used for input but not for output (seeBundleResource.hasOutputType(). Others, such asOutputStreamResource, can be used for output but not for input. Some resource types may be suitable for both (for example seeIOPathResource).The determination is based only on the type of the resource, and does not imply a guarantee about whether the resource type is actually readable.
- Specified by:
hasInputTypein interfaceBundleResource- Returns:
- true if the type of this resource makes it suitable for use as a source of input.
-
hasOutputType
public boolean hasOutputType()Description copied from interface:BundleResourceReturn true if this resource is backed by a type that can be used for output. Some resource types, such asInputStreamResource, can be used for input but not for output (seeBundleResource.hasOutputType(). Others, such asOutputStreamResource, can be used for output but not for input. Some resource types may be suitable for both (for example seeIOPathResource).The determination is based only on the type of the resource, and does not imply a guarantee about whether the resource is actually writeable.
- Specified by:
hasOutputTypein interfaceBundleResource- Returns:
- true if the type of this resource makes it suitable for use as target for output.
-
toString
-
equals
-
hashCode
public int hashCode()
-