类 AbstractResource

    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      long contentLength()
      This method reads the entire InputStream to determine the content length.
      Resource createRelative​(java.lang.String relativePath)
      This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.
      boolean equals​(java.lang.Object other)
      This implementation compares description strings.
      boolean exists()
      This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.
      java.io.File getFile()
      This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.
      protected java.io.File getFileForLastModifiedCheck()
      Determine the File to use for timestamp checking.
      java.lang.String getFilename()
      This implementation always returns null, assuming that this resource type does not have a filename.
      java.net.URI getUri()
      This implementation builds a URI based on the URL returned by getUrl().
      java.net.URL getUrl()
      This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.
      int hashCode()
      This implementation returns the description's hash code.
      boolean isFile()
      This implementation always returns false.
      boolean isOpen()
      This implementation always returns false.
      boolean isReadable()
      This implementation always returns true for a resource that exists (revised as of 5.1).
      long lastModified()
      This implementation checks the timestamp of the underlying File, if available.
      java.nio.channels.ReadableByteChannel readableChannel()
      This implementation returns Channels.newChannel(InputStream) with the result of InputStreamSource.getInputStream().
      java.lang.String toString()
      This implementation returns the description of this resource.
      • 从类继承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 构造器详细资料

      • AbstractResource

        public AbstractResource()
    • 方法详细资料

      • exists

        public boolean exists()
        This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. This will cover both directories and content resources.
        指定者:
        exists 在接口中 Resource
      • isOpen

        public boolean isOpen()
        This implementation always returns false.
        指定者:
        isOpen 在接口中 Resource
      • getUrl

        public java.net.URL getUrl()
                            throws java.io.IOException
        This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.
        指定者:
        getUrl 在接口中 Resource
        抛出:
        java.io.IOException - if the resource cannot be resolved as URL, i.e. if the resource is not available as descriptor
      • getUri

        public java.net.URI getUri()
                            throws java.io.IOException
        This implementation builds a URI based on the URL returned by getUrl().
        指定者:
        getUri 在接口中 Resource
        抛出:
        java.io.IOException - if the resource cannot be resolved as URI, i.e. if the resource is not available as descriptor
      • getFile

        public java.io.File getFile()
                             throws java.io.IOException
        This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.
        指定者:
        getFile 在接口中 Resource
        抛出:
        java.io.FileNotFoundException - if the resource cannot be resolved as absolute file path, i.e. if the resource is not available in a file system
        java.io.IOException - in case of general resolution/reading failures
        另请参阅:
        InputStreamSource.getInputStream()
      • readableChannel

        public java.nio.channels.ReadableByteChannel readableChannel()
                                                              throws java.io.IOException
        This implementation returns Channels.newChannel(InputStream) with the result of InputStreamSource.getInputStream(). This is the same as in Resource's corresponding default method but mirrored here for efficient JVM-level dispatching in a class hierarchy.
        指定者:
        readableChannel 在接口中 Resource
        返回:
        the byte channel for the underlying resource (must not be null)
        抛出:
        java.io.FileNotFoundException - if the underlying resource doesn't exist
        java.io.IOException - if the content channel could not be opened
        另请参阅:
        InputStreamSource.getInputStream()
      • contentLength

        public long contentLength()
                           throws java.io.IOException
        This method reads the entire InputStream to determine the content length. For a custom sub-class of InputStreamResource, we strongly recommend overriding this method with a more optimal implementation, e.g. checking File length, or possibly simply returning -1 if the stream can only be read once.
        指定者:
        contentLength 在接口中 Resource
        抛出:
        java.io.IOException - if the resource cannot be resolved (in the file system or as some other known physical resource type)
        另请参阅:
        InputStreamSource.getInputStream()
      • lastModified

        public long lastModified()
                          throws java.io.IOException
        This implementation checks the timestamp of the underlying File, if available.
        指定者:
        lastModified 在接口中 Resource
        抛出:
        java.io.IOException - if the resource cannot be resolved (in the file system or as some other known physical resource type)
        另请参阅:
        getFileForLastModifiedCheck()
      • getFileForLastModifiedCheck

        protected java.io.File getFileForLastModifiedCheck()
                                                    throws java.io.IOException
        Determine the File to use for timestamp checking. The default implementation delegates to getFile().
        返回:
        the File to use for timestamp checking (never null)
        抛出:
        java.io.FileNotFoundException - if the resource cannot be resolved as an absolute file path, i.e. is not available in a file system
        java.io.IOException - in case of general resolution/reading failures
      • createRelative

        public Resource createRelative​(java.lang.String relativePath)
                                throws java.io.IOException
        This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.
        指定者:
        createRelative 在接口中 Resource
        参数:
        relativePath - the relative path (relative to this resource)
        返回:
        the resource handle for the relative resource
        抛出:
        java.io.IOException - if the relative resource cannot be determined
      • getFilename

        public java.lang.String getFilename()
        This implementation always returns null, assuming that this resource type does not have a filename.
        指定者:
        getFilename 在接口中 Resource
      • equals

        public boolean equals​(java.lang.Object other)
        This implementation compares description strings.
        覆盖:
        equals 在类中 java.lang.Object
        另请参阅:
        Resource.getDescription()
      • hashCode

        public int hashCode()
        This implementation returns the description's hash code.
        覆盖:
        hashCode 在类中 java.lang.Object
        另请参阅:
        Resource.getDescription()
      • toString

        public java.lang.String toString()
        This implementation returns the description of this resource.
        覆盖:
        toString 在类中 java.lang.Object
        另请参阅:
        Resource.getDescription()