java.lang.Object
org.eclipse.jetty.util.resource.Resource
org.eclipse.jetty.util.resource.CombinedResource
Multiple resource directories presented as a single Resource.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCopy the Resource to the new destination file.booleanbooleanexists()Equivalent toFiles.exists(Path, LinkOption...)with the following parameters:Resource.getPath()andLinkOption.NOFOLLOW_LINKS.The file name of the resource.getName()The full name of the resource.getPath()Return the Path corresponding to this resource.Retrieves the resource collection's resources.getURI()URI representing the resource.inthashCode()booleanReturn 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.booleanReturn true if resource represents a directory of potential resources.booleanTrue if the resource is readable.iterator()Return an Iterator of all Resource's referenced in this Resource.The time the resource was last modified.longlength()Length of the resource.list()List of contents of a directoryResource.Resolves a path against the resource collection.toString()Methods inherited from class org.eclipse.jetty.util.resource.Resource
dump, getAllResources, getRealURI, isAlias, newInputStream, newReadableByteChannelMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getResources
Retrieves the resource collection's resources.- Returns:
- the resource collection
-
resolve
Resolves a path against the resource collection.- Specified by:
resolvein classResource- Parameters:
subUriPath- The path segment to resolve- Returns:
- The resulting resource :
- is a file that exists in at least one of the collection, then the first one found is returned
- is a directory that exists in at exactly one of the collection, then that simple directory resource is returned
- is a directory that exists in several of the collection, then a ResourceCollection of those directories is returned
- is null if not found in any entry in this collection
-
exists
public boolean exists()Description copied from class:ResourceEquivalent toFiles.exists(Path, LinkOption...)with the following parameters:Resource.getPath()andLinkOption.NOFOLLOW_LINKS. -
getPath
Description copied from class:ResourceReturn the Path corresponding to this resource. -
getName
Description copied from class:ResourceThe full name of the resource. -
getFileName
Description copied from class:ResourceThe file name of the resource.
This is the last segment of the path.
- Specified by:
getFileNamein classResource- Returns:
- the filename of the resource, or "" if there are no path segments (eg: path of "/"), or null if resource has no path.
- See Also:
-
getURI
Description copied from class:ResourceURI representing the resource. -
isDirectory
public boolean isDirectory()Description copied from class:ResourceReturn true if resource represents a directory of potential resources.- Specified by:
isDirectoryin classResource- Returns:
- true if the represented resource is a container/directory.
-
isReadable
public boolean isReadable()Description copied from class:ResourceTrue if the resource is readable.- Specified by:
isReadablein classResource- Returns:
- true if the represented resource exists, and can read from.
-
lastModified
Description copied from class:ResourceThe time the resource was last modified.- Overrides:
lastModifiedin classResource- Returns:
- the last modified time instant, or
Instant.EPOCHif unable to obtain last modified.
-
length
public long length()Description copied from class:ResourceLength of the resource. -
iterator
Description copied from class:ResourceReturn an Iterator of all Resource's referenced in this Resource.
This is meaningful if you have a Composite Resource, otherwise it will be a single entry Iterator of this resource.
-
list
Description copied from class:ResourceList of contents of a directory
Resource.Ordering is
FileSystemdependent, so callers may wish to sort the return value to ensure deterministic behavior. -
copyTo
Description copied from class:ResourceCopy the Resource to the new destination file.Will not replace existing destination file.
- Overrides:
copyToin classResource- Parameters:
destination- the destination file to create- Throws:
IOException- if unable to copy the resource
-
equals
-
hashCode
public int hashCode() -
toString
-
isContainedIn
Description copied from class:ResourceReturn 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.- Specified by:
isContainedInin classResource- Parameters:
r- the containing resource- Returns:
- true if this Resource is contained, false otherwise
-