public abstract class BundleResourceBase extends java.lang.Object implements BundleResource, java.io.Serializable
BundleResource
implementations.Constructor and Description |
---|
BundleResourceBase(java.lang.String displayName,
java.lang.String contentType,
java.lang.String format)
Base constructor for creating a new bundle resource.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getContentType()
Get the content type for this resource.
|
java.lang.String |
getDisplayName()
Get the display name for this resource.
|
java.util.Optional<java.lang.String> |
getFileFormat()
Get the file format for this resource.
|
java.util.Optional<java.io.InputStream> |
getInputStream()
Get an
InputStream for this resource, or Optional.empty. |
java.util.Optional<IOPath> |
getIOPath()
Get the
IOPath backing this resource, or Optional.empty. |
java.util.Optional<java.io.OutputStream> |
getOutputStream()
Get an
OutputStream for this resource, or Optional.empty. |
java.util.Optional<SeekableStream> |
getSeekableStream()
Get a
SeekableStream for this resource, or Optional.empty. |
int |
hashCode() |
boolean |
hasInputType()
Return true if is this resource is backed by a type that can be used for input.
|
boolean |
hasOutputType()
Return true if this resource is backed by a type that can be used for output.
|
boolean |
hasSeekableStream()
Returns true if this resource can be rendered as a
SeekableStream . |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getSignatureStream
public BundleResourceBase(java.lang.String displayName, java.lang.String contentType, java.lang.String format)
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
in BundleResourceType
.public java.lang.String getDisplayName()
BundleResource
getDisplayName
in interface BundleResource
public java.lang.String getContentType()
BundleResource
getContentType
in interface BundleResource
public java.util.Optional<java.lang.String> getFileFormat()
BundleResource
getFileFormat
in interface BundleResource
public java.util.Optional<IOPath> getIOPath()
BundleResource
IOPath
backing this resource, or Optional.empty.getIOPath
in interface BundleResource
IOPath
backing this resource, or Optional.empty if the resource has no backing
IOPath
public java.util.Optional<java.io.InputStream> getInputStream()
BundleResource
InputStream
for this resource, or Optional.empty.getInputStream
in interface BundleResource
InputStream
for this resource, or Optional.empty if BundleResource.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.public java.util.Optional<java.io.OutputStream> getOutputStream()
BundleResource
OutputStream
for this resource, or Optional.empty.getOutputStream
in interface BundleResource
OutputStream
for this resource, or Optional.empty if BundleResource.hasOutputType()
is false for this resourcepublic java.util.Optional<SeekableStream> getSeekableStream()
BundleResource
SeekableStream
for this resource, or Optional.empty.getSeekableStream
in interface BundleResource
SeekableStream
for this resource, or Optional.empty if this is not an input
type (see BundleResource.hasInputType()
), or is an input type for which no SeekableStream
can be obtained (see BundleResource.hasSeekableStream()
).public boolean hasSeekableStream()
BundleResource
SeekableStream
.hasSeekableStream
in interface BundleResource
SeekableStream
(see BundleResource.getSeekableStream()
)public boolean hasInputType()
BundleResource
InputStreamResource
, can be used for input but not for output (see
BundleResource.hasOutputType()
. Others, such as OutputStreamResource
, can be used for output but not
for input. Some resource types may be suitable for both (for example see IOPathResource
).
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.
hasInputType
in interface BundleResource
public boolean hasOutputType()
BundleResource
InputStreamResource
, can be used for input but not for output (see
BundleResource.hasOutputType()
. Others, such as OutputStreamResource
, can be used for output but
not for input. Some resource types may be suitable for both (for example see IOPathResource
).
The determination is based only on the type of the resource, and does not imply a guarantee about whether the resource is actually writeable.
hasOutputType
in interface BundleResource
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object