Package io.undertow.httpcore
Class UndertowOutputStream
java.lang.Object
java.io.OutputStream
io.undertow.httpcore.UndertowOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Buffering output stream that wraps a channel.
This stream delays channel creation, so if a response will fit in the buffer it is not necessary to set the content length header.
- Author:
- Stuart Douglas
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()longvoidIf the response has not yet been written to the client this method will clear the streams buffer, invalidating any content that has already been written.voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
UndertowOutputStream
Construct a new instance. No write timeout is configured.- Parameters:
exchange- The exchange
-
-
Method Details
-
resetBuffer
public void resetBuffer()If the response has not yet been written to the client this method will clear the streams buffer, invalidating any content that has already been written. If any content has already been sent to the client then this method will throw and IllegalStateException- Throws:
IllegalStateException- If the response has been committed
-
getBytesWritten
public long getBytesWritten() -
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-