Package org.springframework.mock.web
Class DelegatingServletOutputStream
- java.lang.Object
- java.io.OutputStream
- javax.servlet.ServletOutputStream
- org.springframework.mock.web.DelegatingServletOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class DelegatingServletOutputStream extends ServletOutputStream
Delegating implementation ofServletOutputStream
.Used by
MockHttpServletResponse
; typically not directly used for testing application controllers.- Since:
- 1.0.2
- Author:
- Juergen Hoeller
- See Also:
MockHttpServletResponse
Constructor Summary
Constructors Constructor Description DelegatingServletOutputStream(OutputStream targetStream)
Create a DelegatingServletOutputStream for the given target stream.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
OutputStream
getTargetStream()
Return the underlying target stream (nevernull
).void
write(int b)
Methods inherited from class javax.servlet.ServletOutputStream
isReady, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, setWriteListener
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
Constructor Detail
DelegatingServletOutputStream
public DelegatingServletOutputStream(OutputStream targetStream)
Create a DelegatingServletOutputStream for the given target stream.- Parameters:
targetStream
- the target stream (nevernull
)
Method Detail
getTargetStream
public final OutputStream getTargetStream()
Return the underlying target stream (nevernull
).
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException