Class MemoryResource
java.lang.Object
org.eclipse.jetty.util.resource.Resource
org.eclipse.jetty.util.resource.MemoryResource
An in memory Resource
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()Equivalent toFiles.exists(Path, LinkOption...)with the following parameters:Resource.getPath()andLinkOption.NOFOLLOW_LINKS.Get a deep collection of contained resources.byte[]getBytes()The file name of the resource.getName()The full name of the resource.getPath()Return the Path corresponding to this resource.getURI()URI representing the resource.booleanisContainedIn(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.booleanReturn true if resource represents a directory of potential resources.booleanTrue if the resource is readable.The time the resource was last modified.longlength()Length of the resource.list()List of contents of a directoryResource.Creates a new input stream to the resource.Readable ByteChannel for the resource.Resolve an existing Resource.toString()Methods inherited from class Resource
contains, copyTo, dump, getPathTo, getRealURI, isAlias, isSameFile, iteratorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator 
- 
Constructor Details
- 
MemoryResource
 
 - 
 - 
Method Details
- 
getBytes
public byte[] getBytes() - 
getPath
 - 
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.
 
 - 
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.- Overrides:
 isContainedInin classResource- Parameters:
 container- the containing resource- Returns:
 - true if this Resource is contained, false otherwise
 - See Also:
 
 - 
getURI
 - 
getName
 - 
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 cannot determine a filename.
 - See Also:
 
 - 
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
 - 
resolve
Description copied from class:ResourceResolve an existing Resource. - 
newInputStream
Description copied from class:ResourceCreates a new input stream to the resource.- Overrides:
 newInputStreamin classResource- Returns:
 - an input stream to the resource or null if one is not available.
 - Throws:
 IOException- if there is a problem opening the input stream
 - 
newReadableByteChannel
Description copied from class:ResourceReadable ByteChannel for the resource.- Overrides:
 newReadableByteChannelin classResource- Returns:
 - a readable 
ByteChannelto the resource or null if one is not available. - Throws:
 IOException- if unable to open the readable bytechannel for the resource.
 - 
exists
public boolean exists()Description copied from class:ResourceEquivalent toFiles.exists(Path, LinkOption...)with the following parameters:Resource.getPath()andLinkOption.NOFOLLOW_LINKS. - 
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. - 
getAllResources
Description copied from class:ResourceGet a deep collection of contained resources.- Overrides:
 getAllResourcesin classResource- Returns:
 - A collection of all Resources deeply contained within this resource if it is a directory, otherwise an empty collection is returned.
 
 - 
toString
 
 -