Package org.eclipse.jetty.util.resource
Class EmptyResource
- java.lang.Object
 - 
- org.eclipse.jetty.util.resource.Resource
 - 
- org.eclipse.jetty.util.resource.EmptyResource
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable,ResourceFactory
public class EmptyResource extends Resource
EmptyResource Represents a resource that does does not refer to any file, url, jar etc. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static ResourceINSTANCE- 
Fields inherited from class org.eclipse.jetty.util.resource.Resource
__defaultUseCaches 
 - 
 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceaddPath(java.lang.String path)Returns the resource contained inside the current resource with the given name.voidclose()Release any temporary resources held by the resource.booleandelete()Deletes the given resourcebooleanexists()java.io.FilegetFile()File representing the given resource.java.io.InputStreamgetInputStream()Input stream to the resourcejava.lang.StringgetName()The name of the resource.java.nio.channels.ReadableByteChannelgetReadableByteChannel()Readable ByteChannel for the resource.java.net.URLgetURL()URL representing the resource.booleanisContainedIn(Resource r)booleanisDirectory()longlastModified()Time resource was last modified.longlength()Length of the resource.java.lang.String[]list()list of resource names contained in the given resource.booleanrenameTo(Resource dest)Rename the given resource- 
Methods inherited from class org.eclipse.jetty.util.resource.Resource
copyTo, encode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, isSame, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo 
 - 
 
 - 
 
- 
- 
Field Detail
- 
INSTANCE
public static final Resource INSTANCE
 
 - 
 
- 
Method Detail
- 
isContainedIn
public boolean isContainedIn(Resource r) throws java.net.MalformedURLException
- Specified by:
 isContainedInin classResource- Throws:
 java.net.MalformedURLException
 
- 
close
public void close()
Description copied from class:ResourceRelease any temporary resources held by the resource. 
- 
exists
public boolean exists()
 
- 
isDirectory
public boolean isDirectory()
- Specified by:
 isDirectoryin classResource- Returns:
 - true if the represented resource is a container/directory. if the resource is not a file, resources ending with "/" are considered directories.
 
 
- 
lastModified
public long lastModified()
Description copied from class:ResourceTime resource was last modified.- Specified by:
 lastModifiedin classResource- Returns:
 - the last modified time as milliseconds since unix epoch
 
 
- 
length
public long length()
Description copied from class:ResourceLength of the resource. 
- 
getURL
public java.net.URL getURL()
Description copied from class:ResourceURL representing the resource. 
- 
getFile
public java.io.File getFile() throws java.io.IOExceptionDescription copied from class:ResourceFile representing the given resource. 
- 
getName
public java.lang.String getName()
Description copied from class:ResourceThe name of the resource. 
- 
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDescription copied from class:ResourceInput stream to the resource- Specified by:
 getInputStreamin classResource- Returns:
 - an input stream to the resource
 - Throws:
 java.io.IOException- if unable to open the input stream
 
- 
getReadableByteChannel
public java.nio.channels.ReadableByteChannel getReadableByteChannel() throws java.io.IOExceptionDescription copied from class:ResourceReadable ByteChannel for the resource.- Specified by:
 getReadableByteChannelin classResource- Returns:
 - an readable bytechannel to the resource or null if one is not available.
 - Throws:
 java.io.IOException- if unable to open the readable bytechannel for the resource.
 
- 
delete
public boolean delete() throws java.lang.SecurityExceptionDescription copied from class:ResourceDeletes the given resource 
- 
renameTo
public boolean renameTo(Resource dest) throws java.lang.SecurityException
Description copied from class:ResourceRename the given resource 
- 
list
public java.lang.String[] list()
Description copied from class:Resourcelist of resource names contained in the given resource. Ordering is unspecified, so callers may wish to sort the return value to ensure deterministic behavior. 
- 
addPath
public Resource addPath(java.lang.String path) throws java.io.IOException
Description copied from class:ResourceReturns the resource contained inside the current resource with the given name.- Specified by:
 addPathin classResource- Parameters:
 path- The path segment to add, which is not encoded. The path may be non canonical, but if so then the resulting Resource will return true fromResource.isAlias().- Returns:
 - the Resource for the resolved path within this Resource.
 - Throws:
 java.io.IOException- if unable to resolve the pathjava.net.MalformedURLException- if the resolution of the path fails because the input path parameter is malformed, or a relative path attempts to access above the root resource.
 
 - 
 
 -