类 InputStreamResource
java.lang.Object
cn.taketoday.core.io.AbstractResource
cn.taketoday.core.io.InputStreamResource
- 所有已实现的接口:
InputStreamSource,Resource,ThrowingConsumer<OutputStream>,Consumer<OutputStream>
Resource implementation for a given InputStream.
Should only be used if no other specific Resource implementation
is applicable. In particular, prefer ByteArrayResource or any of the
file-based Resource implementations where possible.
In contrast to other Resource implementations, this is a descriptor
for an already opened resource. Do not use an InputStreamResource
if you need to keep the resource descriptor somewhere, or if you need to read
from a stream multiple times.
- 从以下版本开始:
- 3.0
- 作者:
- Juergen Hoeller, Sam Brannen, TODAY 2021/3/7 11:18
- 另请参阅:
-
字段概要
字段从接口继承的字段 cn.taketoday.core.io.Resource
EMPTY_ARRAY -
构造器概要
构造器构造器说明InputStreamResource(InputStream inputStream) Create a new InputStreamResource.InputStreamResource(InputStream inputStream, String description) Create a new InputStreamResource. -
方法概要
修饰符和类型方法说明booleanThis implementation compares the underlying InputStream.booleanexists()This implementation always returnstrue.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.toString()This implementation returns a description that includes the passed-in description, if any.从类继承的方法 cn.taketoday.core.io.AbstractResource
contentLength, createRelative, customizeConnection, customizeConnection, getFile, getFileForLastModifiedCheck, getName, getURI, getURL, isDirectory, isFile, isReadable, lastModified, list, list从接口继承的方法 cn.taketoday.core.io.InputStreamSource
acceptWithException, getReader, getReader, readableChannel, transferTo从接口继承的方法 cn.taketoday.core.io.Resource
getContentAsByteArray, getContentAsString从接口继承的方法 cn.taketoday.util.function.ThrowingConsumer
accept, accept, throwing
-
字段详细资料
-
read
private boolean read -
description
-
inputStream
-
-
构造器详细资料
-
InputStreamResource
Create a new InputStreamResource.- 参数:
inputStream- the InputStream to use
-
InputStreamResource
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
This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.- 返回:
- 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 openedIllegalStateException- 另请参阅:
-
toString
This implementation returns a description that includes the passed-in description, if any.- 指定者:
toString在接口中Resource- 覆盖:
toString在类中AbstractResource- 另请参阅:
-
equals
This implementation compares the underlying InputStream.- 覆盖:
equals在类中AbstractResource
-
hashCode
public int hashCode()This implementation returns the hash code of the underlying InputStream.- 覆盖:
hashCode在类中AbstractResource
-