A Resource is a wrapper over a Path object pointing to a file or directory that can be represented by ajava..
Supports real filesystems, and also ZipFS.
| Modifier and Type | Field and Description |
|---|---|
| private static final Logger | |
| private static final LinkOption[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | |
| public static String | |
| pack-priv void | |
| public boolean | Returns: true if the represented resource exists.Equivalent to |
| public Collection | Returns: A collection of all Resources deeply contained within this resource if it is a directory, otherwise an empty collection is returned.Get a deep collection of contained resources. |
| public abstract String | Returns: the filename of the resource, or "" if there are no path segments (eg: path of "/"), or null if resource cannot determine a filename.The file name of the resource. |
| public abstract String | Returns: the full name of the resource, or null if there is no name for the resource.The full name of the resource. |
| public abstract Path | Returns: the path or null if there is no Path representation.Return the Path corresponding to this resource. |
| public Path | Returns: a relative Path representing the path from this resource to the other resource, or null if not able to represent other resources as relative to this resourceThe other resource that may be contained in this resource other)Get the relative path from this Resource to a possibly contained resource. |
| public URI | |
| public abstract URI | Returns: a URI representing the given resource, or null if there is no URI representation of the resource.URI representing the resource. |
| public boolean | |
| public boolean | Returns: true if this Resource is contained, false otherwisethe containing resource container)Return true if this resource is contained in the Resource r, either because r is a folder or a jar file or any form of resource capable of containing other resources. |
| public abstract boolean | Returns: true if the represented resource is a container/directory.Return true if resource represents a directory of potential resources. |
| public abstract boolean | Returns: true if the represented resource exists, and can read from.True if the resource is readable. |
| public Iterator | Returns: the iterator of Resources.Implements java. Return an Iterator of all Resource's referenced in this Resource. |
| public Instant | Returns: the last modified time instant, orInstant#EPOCH if unable to obtain last modified.The time the resource was last modified. |
| public long | Returns: the length of the resource in bytes, or -1L if unable to provide a size (such as a directory resource).Length of the resource. |
| public List | |
| public InputStream | Returns: an input stream to the resource or null if one is not available.Creates a new input stream to the resource. |
| public ReadableByteChannel | Returns: a readablejava. to the resource or null if one is not available.Readable ByteChannel for the resource. |
| public abstract Resource | |
| pack-priv static Path |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| NO_FOLLOW_LINKS | back to summary |
|---|---|
| private static final LinkOption[] NO_FOLLOW_LINKS | |
| Resource | back to summary |
|---|---|
| public Resource() | |
| contains | back to summary |
|---|---|
| public boolean contains(Resource other) Return true if this resource deeply contains the other Resource. This resource must be a directory or a jar file or any form of resource capable of containing other resources.
| |
| copyTo | back to summary |
|---|---|
| public void copyTo(Path destination) throws IOException Copy the Resource to the new destination file or directory
| |
| dump | back to summary |
|---|---|
| public static String dump(Resource resource) | |
| ensureDirExists | back to summary |
|---|---|
| pack-priv void ensureDirExists(Path dir) throws IOException | |
| exists | back to summary |
|---|---|
| public boolean exists() Equivalent to
| |
| getAllResources | back to summary |
|---|---|
| public Collection Get a deep collection of contained resources.
| |
| getFileName | back to summary |
|---|---|
| public abstract String getFileName() The file name of the resource. This is the last segment of the path.
| |
| getName | back to summary |
|---|---|
| public abstract String getName() The full name of the resource.
| |
| getPath | back to summary |
|---|---|
| public abstract Path getPath() Return the Path corresponding to this resource.
| |
| getPathTo | back to summary |
|---|---|
| public Path getPathTo(Resource other) Get the relative path from this Resource to a possibly contained resource. | |
| getRealURI | back to summary |
|---|---|
| public URI getRealURI() The real URI of the resource. If this Resource is an alias, (
| |
| getURI | back to summary |
|---|---|
| public abstract URI getURI() URI representing the resource.
| |
| isAlias | back to summary |
|---|---|
public boolean isAlias()
| |
| isContainedIn | back to summary |
|---|---|
| public boolean isContainedIn(Resource container) Return true if this resource is contained in the Resource r, either because r is a folder or a jar file or any form of resource capable of containing other resources.
| |
| isDirectory | back to summary |
|---|---|
| public abstract boolean isDirectory() Return true if resource represents a directory of potential resources.
| |
| isReadable | back to summary |
|---|---|
| public abstract boolean isReadable() True if the resource is readable.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Return an Iterator of all Resource's referenced in this Resource. This is meaningful if you have a | |
| lastModified | back to summary |
|---|---|
| public Instant lastModified() The time the resource was last modified.
| |
| length | back to summary |
|---|---|
| public long length() Length of the resource.
| |
| list | back to summary |
|---|---|
| public List List of contents of a directory Ordering is
| |
| newInputStream | back to summary |
|---|---|
| public InputStream newInputStream() throws IOException Creates a new input stream to the resource.
| |
| newReadableByteChannel | back to summary |
|---|---|
| public ReadableByteChannel newReadableByteChannel() throws IOException Readable ByteChannel for the resource.
| |
| resolve | back to summary |
|---|---|
| public abstract Resource resolve(String subUriPath) Resolve an existing Resource.
| |
| resolveDifferentFileSystem | back to summary |
|---|---|
| pack-priv static Path resolveDifferentFileSystem(Path path, Path relative) | |