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