org.eclipse.jetty.util.resource
类 FileResource

java.lang.Object
  继承者 org.eclipse.jetty.util.resource.Resource
      继承者 org.eclipse.jetty.util.resource.URLResource
          继承者 org.eclipse.jetty.util.resource.FileResource
所有已实现的接口:
ResourceFactory

public class FileResource
extends URLResource

File Resource. Handle resources of implied or explicit file type. This class can check for aliasing in the filesystem (eg case insensitivity). By default this is turned on, or it can be controlled by calling the static method @see FileResource#setCheckAliases(boolean)


字段摘要
 
从类 org.eclipse.jetty.util.resource.URLResource 继承的字段
_connection, _in, _url, _urlString
 
从类 org.eclipse.jetty.util.resource.Resource 继承的字段
__defaultUseCaches
 
构造方法摘要
FileResource(URL url)
           
 
方法摘要
 Resource addPath(String path)
          Returns the resource contained inside the current resource with the given name
 void copyTo(File destination)
           
 boolean delete()
          Deletes the given resource
 String encode(String uri)
          Encode according to this resource type.
 boolean equals(Object o)
           
 boolean exists()
          Returns true if the resource exists.
 URL getAlias()
           
static boolean getCheckAliases()
          getCheckAliases.
 File getFile()
          Returns an File representing the given resource or NULL if this is not possible.
 InputStream getInputStream()
          Returns an input stream to the resource
 String getName()
          Returns the name of the resource
 OutputStream getOutputStream()
          Returns an output stream to the resource
 int hashCode()
           
 boolean isDirectory()
          Returns true if the respresenetd resource is a container/directory.
 long lastModified()
          Returns the last modified time
 long length()
          Return the length of the resource
 String[] list()
          Returns a list of resources contained in the given resource
 boolean renameTo(Resource dest)
          Rename the given resource
static void setCheckAliases(boolean checkAliases)
          setCheckAliases.
 
从类 org.eclipse.jetty.util.resource.URLResource 继承的方法
checkConnection, getURL, getUseCaches, isContainedIn, release, toString
 
从类 org.eclipse.jetty.util.resource.Resource 继承的方法
finalize, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, setAssociate, setDefaultUseCaches, toURL, writeTo
 
从类 java.lang.Object 继承的方法
clone, getClass, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

FileResource

public FileResource(URL url)
             throws IOException,
                    URISyntaxException
抛出:
IOException
URISyntaxException
方法详细信息

setCheckAliases

public static void setCheckAliases(boolean checkAliases)
setCheckAliases.

参数:
checkAliases - True of resource aliases are to be checked for (eg case insensitivity or 8.3 short names) and treated as not found.

getCheckAliases

public static boolean getCheckAliases()
getCheckAliases.

返回:
True of resource aliases are to be checked for (eg case insensitivity or 8.3 short names) and treated as not found.

addPath

public Resource addPath(String path)
                 throws IOException,
                        MalformedURLException
从类 URLResource 复制的描述
Returns the resource contained inside the current resource with the given name

覆盖:
URLResource 中的 addPath
参数:
path - The path segment to add, which should be encoded by the encode method.
抛出:
IOException
MalformedURLException

getAlias

public URL getAlias()
覆盖:
Resource 中的 getAlias
返回:
The canonical Alias of this resource or null if none.

exists

public boolean exists()
Returns true if the resource exists.

覆盖:
URLResource 中的 exists

lastModified

public long lastModified()
Returns the last modified time

覆盖:
URLResource 中的 lastModified

isDirectory

public boolean isDirectory()
Returns true if the respresenetd resource is a container/directory.

覆盖:
URLResource 中的 isDirectory

length

public long length()
Return the length of the resource

覆盖:
URLResource 中的 length

getName

public String getName()
Returns the name of the resource

覆盖:
URLResource 中的 getName

getFile

public File getFile()
Returns an File representing the given resource or NULL if this is not possible.

覆盖:
URLResource 中的 getFile

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns an input stream to the resource

覆盖:
URLResource 中的 getInputStream
抛出:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException,
                                    SecurityException
Returns an output stream to the resource

覆盖:
URLResource 中的 getOutputStream
抛出:
IOException
SecurityException

delete

public boolean delete()
               throws SecurityException
Deletes the given resource

覆盖:
URLResource 中的 delete
抛出:
SecurityException

renameTo

public boolean renameTo(Resource dest)
                 throws SecurityException
Rename the given resource

覆盖:
URLResource 中的 renameTo
抛出:
SecurityException

list

public String[] list()
Returns a list of resources contained in the given resource

覆盖:
URLResource 中的 list

encode

public String encode(String uri)
Encode according to this resource type. File URIs are encoded.

覆盖:
Resource 中的 encode
参数:
uri - URI to encode.
返回:
The uri unchanged.

equals

public boolean equals(Object o)
覆盖:
URLResource 中的 equals
参数:
o -
返回:
true of the object o is a FileResource pointing to the same file as this resource.

hashCode

public int hashCode()
覆盖:
URLResource 中的 hashCode
返回:
the hashcode.

copyTo

public void copyTo(File destination)
            throws IOException
覆盖:
Resource 中的 copyTo
抛出:
IOException


Copyright © 2013. All Rights Reserved.