Package io.undertow.io
Class UndertowOutputStream
java.lang.Object
java.io.OutputStream
io.undertow.io.UndertowOutputStream
- All Implemented Interfaces:
BufferWritableOutputStream
,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 TypeMethodDescriptionvoid
close()
void
flush()
long
void
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.void
transferFrom
(FileChannel source) void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) void
write
(ByteBuffer byteBuffer) void
write
(ByteBuffer[] buffers) 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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in interfaceBufferWritableOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in interfaceBufferWritableOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
transferFrom
- Specified by:
transferFrom
in interfaceBufferWritableOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-