类 InputStreamResource
- java.lang.Object
-
- com.alibaba.nacos.common.packagescan.resource.AbstractResource
-
- com.alibaba.nacos.common.packagescan.resource.InputStreamResource
-
- 所有已实现的接口:
InputStreamSource,Resource
public class InputStreamResource extends AbstractResource
Copy from https://github.com/spring-projects/spring-framework.git, with less modificationsResourceimplementation for a givenInputStream.Should only be used if no other specific
Resourceimplementation is applicable. In particular, preferByteArrayResourceor any of the file-basedResourceimplementations where possible.In contrast to other
Resourceimplementations, this is a descriptor for an already opened resource - therefore returningtruefromisOpen(). Do not use anInputStreamResourceif you need to keep the resource descriptor somewhere, or if you need to read from a stream multiple times.- 从以下版本开始:
- 28.12.2003
- 作者:
- Juergen Hoeller, Sam Brannen
- 另请参阅:
ByteArrayResource,ClassPathResource,FileSystemResource,UrlResource
-
-
字段概要
字段 修饰符和类型 字段 说明 private java.lang.Stringdescriptionprivate java.io.InputStreaminputStreamprivate booleanread
-
构造器概要
构造器 构造器 说明 InputStreamResource(java.io.InputStream inputStream)Create a new InputStreamResource.InputStreamResource(java.io.InputStream inputStream, java.lang.String description)Create a new InputStreamResource.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(java.lang.Object other)This implementation compares the underlying InputStream.booleanexists()This implementation always returnstrue.java.lang.StringgetDescription()This implementation returns a description that includes the passed-in description, if any.java.io.InputStreamgetInputStream()This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.inthashCode()This implementation returns the hash code of the underlying InputStream.booleanisOpen()This implementation always returnstrue.-
从类继承的方法 com.alibaba.nacos.common.packagescan.resource.AbstractResource
contentLength, createRelative, getFile, getFileForLastModifiedCheck, getFilename, getUri, getUrl, isFile, isReadable, lastModified, readableChannel, toString
-
-
-
-
构造器详细资料
-
InputStreamResource
public InputStreamResource(java.io.InputStream inputStream)
Create a new InputStreamResource.- 参数:
inputStream- the InputStream to use
-
InputStreamResource
public InputStreamResource(java.io.InputStream inputStream, java.lang.String description)Create a new InputStreamResource.- 参数:
inputStream- the InputStream to usedescription- where the InputStream comes from
-
-
方法详细资料
-
exists
public boolean exists()
This implementation always returnstrue.- 指定者:
exists在接口中Resource- 覆盖:
exists在类中AbstractResource
-
isOpen
public boolean isOpen()
This implementation always returnstrue.- 指定者:
isOpen在接口中Resource- 覆盖:
isOpen在类中AbstractResource
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException, java.lang.IllegalStateExceptionThis implementation throws IllegalStateException if attempting to read the underlying stream multiple times.- 返回:
- 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 openedjava.lang.IllegalStateException- 另请参阅:
Resource.isReadable()
-
getDescription
public java.lang.String getDescription()
This implementation returns a description that includes the passed-in description, if any.- 另请参阅:
Object.toString()
-
equals
public boolean equals(java.lang.Object other)
This implementation compares the underlying InputStream.- 覆盖:
equals在类中AbstractResource- 另请参阅:
Resource.getDescription()
-
hashCode
public int hashCode()
This implementation returns the hash code of the underlying InputStream.- 覆盖:
hashCode在类中AbstractResource- 另请参阅:
Resource.getDescription()
-
-