Package org.springframework.mock.web
Class DelegatingServletInputStream
- java.lang.Object
- java.io.InputStream
- javax.servlet.ServletInputStream
- org.springframework.mock.web.DelegatingServletInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class DelegatingServletInputStream extends ServletInputStream
Delegating implementation ofServletInputStream
.Used by
MockHttpServletRequest
; typically not directly used for testing application controllers.- Since:
- 1.0.2
- Author:
- Juergen Hoeller
- See Also:
MockHttpServletRequest
Constructor Summary
Constructors Constructor Description DelegatingServletInputStream(InputStream sourceStream)
Create a DelegatingServletInputStream for the given source stream.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
InputStream
getSourceStream()
Return the underlying source stream (nevernull
).int
read()
Methods inherited from class javax.servlet.ServletInputStream
isFinished, isReady, readLine, setReadListener
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
Constructor Detail
DelegatingServletInputStream
public DelegatingServletInputStream(InputStream sourceStream)
Create a DelegatingServletInputStream for the given source stream.- Parameters:
sourceStream
- the source stream (nevernull
)
Method Detail
getSourceStream
public final InputStream getSourceStream()
Return the underlying source stream (nevernull
).
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException