public class HtsPath extends java.lang.Object implements IOPath, java.io.Serializable
java.nio file system provider that matches the URI scheme
3) isPath: syntactically valid URI that can be resolved to a java.io.Path by the associated provider
Definitions taken from RFC 2396 "Uniform Resource Identifiers (URI): Generic Syntax"
(https://www.ietf.org/rfc/rfc2396.txt):
"absolute" URI - specifies a scheme
"relative" URI - does not specify a scheme
"opaque" URI - an "absolute" URI whose scheme-specific part does not begin with a slash character
"hierarchical" URI - either an "absolute" URI whose scheme-specific part begins with a slash character,
or a "relative" URI (no scheme)
URIs that do not make use of the slash "/" character for separating hierarchical components are
considered "opaque" by the generic URI parser.
General syntax for an "absolute" URI:
| Constructor and Description |
|---|
HtsPath(HtsPath htsPath)
Create an HtsPath from an existing HtsPath.
|
HtsPath(java.lang.String rawInputString)
Create an HtsPath from a raw input path string.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
protected java.nio.file.Path |
getCachedPath() |
java.io.InputStream |
getInputStream()
Get a
InputStream for this URI if a provider is for the URI's scheme is available. |
java.io.OutputStream |
getOutputStream()
Get an
OutputStream for this URI if a provider is for the URI's scheme. |
java.lang.String |
getRawInputString()
Return the raw input string provided to the constructor.
|
java.lang.String |
getToPathFailureReason()
Return a string message describing why this URI cannot be converted to a
java.nio.file.Path
(#isPath() returns false). |
java.net.URI |
getURI()
Get a
java.net.URI object for this IOPath. |
java.lang.String |
getURIString()
Returns the string from which this
IOPath was originally created. |
boolean |
hasFileSystemProvider() |
int |
hashCode() |
boolean |
isPath()
Return true if this {code IOPath} can be resolved to an
java.nio Path. |
protected void |
setCachedPath(java.nio.file.Path path) |
java.nio.file.Path |
toPath()
Resolve the URI to a
Path object. |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBaseName, getExtension, getScheme, hasExtension, isBam, isCram, isFasta, isSampublic HtsPath(java.lang.String rawInputString)
rawInputString - a string specifying an input path. May not be null.public HtsPath(HtsPath htsPath)
htsPath - an existing PathSpecifier. May not be null.public java.net.URI getURI()
IOPathjava.net.URI object for this IOPath. Will not be null.public java.lang.String getURIString()
IOPathIOPath was originally created. This string may differ from
the normalized string returned from a java.nio.file.Path that has been object resolved from this IOPath.getURIString in interface IOPathpublic java.lang.String getRawInputString()
getRawInputString in interface IOPathpublic boolean hasFileSystemProvider()
hasFileSystemProvider in interface IOPathjava.nio file system provider
(). This does not
guarantee the URI can be converted into a java.nio.file.Path, since the URI can be syntactically
valid, and specify a valid file system provider, but still fail to be semantically meaningful.public boolean isPath()
IOPathjava.nio Path. If true, #toPath() can be
safely called.
There are cases where a valid URI with a valid scheme backed by an installed java.nio File System
still can't be turned into a {@code java.nio.file.Path}, i.e., the following specifies an invalid
authority "namenode":
hdfs://namenode/to/file
The current implementation returns false for these cases (toPath will fail, getInvalidPathReason
returns the reason code).public java.nio.file.Path toPath()
Path object.public java.lang.String getToPathFailureReason()
IOPathjava.nio.file.Path
(#isPath() returns false).getToPathFailureReason in interface IOPathpublic java.io.InputStream getInputStream()
IOPathInputStream for this URI if a provider is for the URI's scheme is available.getInputStream in interface IOPathInputStream for this URI.public java.io.OutputStream getOutputStream()
IOPathOutputStream for this URI if a provider is for the URI's scheme.getOutputStream in interface IOPathOutputStream for this URI.protected java.nio.file.Path getCachedPath()
protected void setCachedPath(java.nio.file.Path path)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object