类 DelegatingServletInputStream
- java.lang.Object
- java.io.InputStream
- javax.servlet.ServletInputStream
- org.springframework.mock.web.DelegatingServletInputStream
- 所有已实现的接口:
Closeable
,AutoCloseable
public class DelegatingServletInputStream extends ServletInputStream
Delegating implementation ofServletInputStream
.Used by
MockHttpServletRequest
; typically not directly used for testing application controllers.- 从以下版本开始:
- 1.0.2
- 作者:
- Juergen Hoeller
- 另请参阅:
MockHttpServletRequest
构造器概要
构造器 构造器 说明 DelegatingServletInputStream(InputStream sourceStream)
Create a DelegatingServletInputStream for the given source stream.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 int
available()
void
close()
InputStream
getSourceStream()
Return the underlying source stream (nevernull
).boolean
isFinished()
Returns true when all the data from the stream has been read else it returns false.boolean
isReady()
Returns true if data can be read without blocking else returns false.int
read()
void
setReadListener(ReadListener readListener)
Instructs theServletInputStream
to invoke the providedReadListener
when it is possible to read从类继承的方法 javax.servlet.ServletInputStream
readLine
从类继承的方法 java.io.InputStream
mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
构造器详细资料
DelegatingServletInputStream
public DelegatingServletInputStream(InputStream sourceStream)
Create a DelegatingServletInputStream for the given source stream.- 参数:
sourceStream
- the source stream (nevernull
)
方法详细资料
getSourceStream
public final InputStream getSourceStream()
Return the underlying source stream (nevernull
).
read
public int read() throws IOException
- 指定者:
read
在类中InputStream
- 抛出:
IOException
available
public int available() throws IOException
- 覆盖:
available
在类中InputStream
- 抛出:
IOException
close
public void close() throws IOException
- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中Closeable
- 覆盖:
close
在类中InputStream
- 抛出:
IOException
isFinished
public boolean isFinished()
从类复制的说明:javax.servlet.ServletInputStream
Returns true when all the data from the stream has been read else it returns false.- 指定者:
isFinished
在类中ServletInputStream
- 返回:
true
when all data for this particular request has been read, otherwise returnsfalse
.
isReady
public boolean isReady()
从类复制的说明:javax.servlet.ServletInputStream
Returns true if data can be read without blocking else returns false.- 指定者:
isReady
在类中ServletInputStream
- 返回:
true
if data can be obtained without blocking, otherwise returnsfalse
.
setReadListener
public void setReadListener(ReadListener readListener)
从类复制的说明:javax.servlet.ServletInputStream
Instructs theServletInputStream
to invoke the providedReadListener
when it is possible to read- 指定者:
setReadListener
在类中ServletInputStream
- 参数:
readListener
- theReadListener
that should be notified when it's possible to read.