public class DelegatingServletInputStream extends ServletInputStream
ServletInputStream.
Used by MockHttpServletRequest; typically not directly
used for testing application controllers.
MockHttpServletRequest| Constructor and Description |
|---|
DelegatingServletInputStream(java.io.InputStream sourceStream)
Create a DelegatingServletInputStream for the given source stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
java.io.InputStream |
getSourceStream()
Return the underlying source stream (never
null). |
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 the
ServletInputStream to invoke the provided
ReadListener when it is possible to read |
readLinepublic DelegatingServletInputStream(java.io.InputStream sourceStream)
sourceStream - the source stream (never null)public final java.io.InputStream getSourceStream()
null).public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic boolean isFinished()
javax.servlet.ServletInputStreamisFinished in class ServletInputStreamtrue when all data for this particular request
has been read, otherwise returns false.public boolean isReady()
javax.servlet.ServletInputStreamisReady in class ServletInputStreamtrue if data can be obtained without blocking,
otherwise returns false.public void setReadListener(ReadListener readListener)
javax.servlet.ServletInputStreamServletInputStream to invoke the provided
ReadListener when it is possible to readsetReadListener in class ServletInputStreamreadListener - the ReadListener that should be notified
when it's possible to read.