类 VfsResource
- java.lang.Object
-
- com.alibaba.nacos.common.packagescan.resource.AbstractResource
-
- com.alibaba.nacos.common.packagescan.resource.VfsResource
-
- 所有已实现的接口:
InputStreamSource,Resource
public class VfsResource extends AbstractResource
Copy from https://github.com/spring-projects/spring-framework.git, with less modifications JBoss VFS basedResourceimplementation.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
-
-
字段概要
字段 修饰符和类型 字段 说明 private java.lang.Objectresource
-
构造器概要
构造器 构造器 说明 VfsResource(java.lang.Object resource)Create a newVfsResourcewrapping the given resource handle.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 longcontentLength()This method reads the entire InputStream to determine the content length.ResourcecreateRelative(java.lang.String relativePath)This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.booleanequals(java.lang.Object other)This implementation compares description strings.booleanexists()This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened.java.lang.StringgetDescription()Return a description for this resource, to be used for error output when working with the resource.java.io.FilegetFile()This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.java.lang.StringgetFilename()This implementation always returnsnull, assuming that this resource type does not have a filename.java.io.InputStreamgetInputStream()Return anInputStreamfor the content of an underlying resource.java.net.URIgetUri()This implementation builds a URI based on the URL returned byAbstractResource.getUrl().java.net.URLgetUrl()This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.inthashCode()This implementation returns the description's hash code.booleanisReadable()This implementation always returnstruefor a resource thatexists(revised as of 5.1).longlastModified()This implementation checks the timestamp of the underlying File, if available.-
从类继承的方法 com.alibaba.nacos.common.packagescan.resource.AbstractResource
getFileForLastModifiedCheck, isFile, isOpen, readableChannel, toString
-
-
-
-
方法详细资料
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException从接口复制的说明: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) - 抛出:
java.io.FileNotFoundException- if the underlying resource does not existjava.io.IOException- if the content stream could not be opened- 另请参阅:
Resource.isReadable()
-
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- 另请参阅:
InputStreamSource.getInputStream(),Resource.exists()
-
getUrl
public java.net.URL getUrl() throws java.io.IOException从类复制的说明:AbstractResourceThis implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.- 指定者:
getUrl在接口中Resource- 覆盖:
getUrl在类中AbstractResource- 抛出:
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从类复制的说明:AbstractResourceThis implementation builds a URI based on the URL returned byAbstractResource.getUrl().- 指定者:
getUri在接口中Resource- 覆盖:
getUri在类中AbstractResource- 抛出:
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从类复制的说明:AbstractResourceThis implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.- 指定者:
getFile在接口中Resource- 覆盖:
getFile在类中AbstractResource- 抛出:
java.io.FileNotFoundException- if the resource cannot be resolved as absolute file path, i.e. if the resource is not available in a file systemjava.io.IOException- in case of general resolution/reading failures- 另请参阅:
InputStreamSource.getInputStream()
-
contentLength
public long contentLength() throws java.io.IOException从类复制的说明: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- 抛出:
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从类复制的说明:AbstractResourceThis implementation checks the timestamp of the underlying File, if available.- 指定者:
lastModified在接口中Resource- 覆盖:
lastModified在类中AbstractResource- 抛出:
java.io.IOException- if the resource cannot be resolved (in the file system or as some other known physical resource type)- 另请参阅:
AbstractResource.getFileForLastModifiedCheck()
-
createRelative
public Resource createRelative(java.lang.String relativePath) throws java.io.IOException
从类复制的说明: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
- 抛出:
java.io.IOException- if the relative resource cannot be determined
-
getFilename
public java.lang.String getFilename()
从类复制的说明:AbstractResourceThis implementation always returnsnull, assuming that this resource type does not have a filename.- 指定者:
getFilename在接口中Resource- 覆盖:
getFilename在类中AbstractResource
-
getDescription
public java.lang.String 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.- 另请参阅:
Object.toString()
-
equals
public boolean equals(java.lang.Object other)
从类复制的说明:AbstractResourceThis implementation compares description strings.- 覆盖:
equals在类中AbstractResource- 另请参阅:
Resource.getDescription()
-
hashCode
public int hashCode()
从类复制的说明:AbstractResourceThis implementation returns the description's hash code.- 覆盖:
hashCode在类中AbstractResource- 另请参阅:
Resource.getDescription()
-
-