类 VfsResource
java.lang.Object
com.alibaba.nacos.common.packagescan.resource.AbstractResource
com.alibaba.nacos.common.packagescan.resource.VfsResource
- 所有已实现的接口:
InputStreamSource,Resource
Copy from https://github.com/spring-projects/spring-framework.git, with less modifications
JBoss VFS based
Resource implementation.
As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+
(package org.jboss.vfs) and is in particular compatible with
JBoss AS 7 and WildFly 8+.
- 从以下版本开始:
- 3.0
- 作者:
- Ales Justin, Juergen Hoeller, Costin Leau, Sam Brannen
- 另请参阅:
-
org.jboss.vfs.VirtualFile
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明longThis method reads the entire InputStream to determine the content length.createRelative(String relativePath) This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.booleanThis implementation compares description strings.booleanexists()This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.Return a description for this resource, to be used for error output when working with the resource.getFile()This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.This implementation always returnsnull, assuming that this resource type does not have a filename.Return anInputStreamfor the content of an underlying resource.getUri()This implementation builds a URI based on the URL returned byAbstractResource.getUrl().getUrl()This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.inthashCode()This implementation returns the description's hash code.booleanThis implementation always returnstruefor a resource thatexists(revised as of 5.1).longThis implementation checks the timestamp of the underlying File, if available.从类继承的方法 com.alibaba.nacos.common.packagescan.resource.AbstractResource
getFileForLastModifiedCheck, isFile, isOpen, readableChannel, toString
-
构造器详细资料
-
VfsResource
Create a newVfsResourcewrapping the given resource handle.- 参数:
resource- aorg.jboss.vfs.VirtualFileinstance (untyped in order to avoid a static dependency on the VFS API)
-
-
方法详细资料
-
getInputStream
从接口复制的说明:InputStreamSourceReturn anInputStreamfor the content of an underlying resource.It is expected that each call creates a fresh stream.
This requirement is particularly important when you consider an API such as JavaMail, which needs to be able to read the stream multiple times when creating mail attachments. For such a use case, it is required that each
getInputStream()call returns a fresh stream.- 返回:
- the input stream for the underlying resource (must not be
null) - 抛出:
FileNotFoundException- if the underlying resource does not existIOException- if the content stream could not be opened- 另请参阅:
-
exists
public boolean exists()从类复制的说明:AbstractResourceThis 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- 覆盖:
exists在类中AbstractResource
-
isReadable
public boolean isReadable()从类复制的说明:AbstractResourceThis implementation always returnstruefor a resource thatexists(revised as of 5.1).- 指定者:
isReadable在接口中Resource- 覆盖:
isReadable在类中AbstractResource- 另请参阅:
-
getUrl
从类复制的说明:AbstractResourceThis implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.- 指定者:
getUrl在接口中Resource- 覆盖:
getUrl在类中AbstractResource- 抛出:
IOException- if the resource cannot be resolved as URL, i.e. if the resource is not available as descriptor
-
getUri
从类复制的说明:AbstractResourceThis implementation builds a URI based on the URL returned byAbstractResource.getUrl().- 指定者:
getUri在接口中Resource- 覆盖:
getUri在类中AbstractResource- 抛出:
IOException- if the resource cannot be resolved as URI, i.e. if the resource is not available as descriptor
-
getFile
从类复制的说明:AbstractResourceThis implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.- 指定者:
getFile在接口中Resource- 覆盖:
getFile在类中AbstractResource- 抛出:
FileNotFoundException- if the resource cannot be resolved as absolute file path, i.e. if the resource is not available in a file systemIOException- in case of general resolution/reading failures- 另请参阅:
-
contentLength
从类复制的说明:AbstractResourceThis method reads the entire InputStream to determine the content length. For a custom sub-class ofInputStreamResource, 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- 覆盖:
contentLength在类中AbstractResource- 抛出:
IOException- if the resource cannot be resolved (in the file system or as some other known physical resource type)- 另请参阅:
-
lastModified
从类复制的说明:AbstractResourceThis implementation checks the timestamp of the underlying File, if available.- 指定者:
lastModified在接口中Resource- 覆盖:
lastModified在类中AbstractResource- 抛出:
IOException- if the resource cannot be resolved (in the file system or as some other known physical resource type)- 另请参阅:
-
createRelative
从类复制的说明:AbstractResourceThis implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.- 指定者:
createRelative在接口中Resource- 覆盖:
createRelative在类中AbstractResource- 参数:
relativePath- the relative path (relative to this resource)- 返回:
- the resource handle for the relative resource
- 抛出:
IOException- if the relative resource cannot be determined
-
getFilename
从类复制的说明:AbstractResourceThis implementation always returnsnull, assuming that this resource type does not have a filename.- 指定者:
getFilename在接口中Resource- 覆盖:
getFilename在类中AbstractResource
-
getDescription
从接口复制的说明:ResourceReturn a description for this resource, to be used for error output when working with the resource.Implementations are also encouraged to return this value from their
toStringmethod.- 另请参阅:
-
equals
从类复制的说明:AbstractResourceThis implementation compares description strings.- 覆盖:
equals在类中AbstractResource- 另请参阅:
-
hashCode
public int hashCode()从类复制的说明:AbstractResourceThis implementation returns the description's hash code.- 覆盖:
hashCode在类中AbstractResource- 另请参阅:
-