public class ServletOutputStreamImpl
extends javax.servlet.ServletOutputStream
If a content-length header was present when the stream was created then it will automatically close and flush itself once the appropriate amount of data has been written.
Once the listener has been set it goes into async mode, and writes become non blocking. Most methods have two different code paths, based on if the listener has been set or not
Once the write listener has been set operations must only be invoked on this stream from the write listener callback. Attempting to invoke from a different thread will result in an IllegalStateException.
Async listener tasks are queued in the AsyncContextImpl. At most one listener can be active at
one time, which simplifies the thread safety requirements.
| Constructor and Description |
|---|
ServletOutputStreamImpl(HttpServerExchange exchange)
Construct a new instance.
|
ServletOutputStreamImpl(HttpServerExchange exchange,
Integer bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
io.netty.buffer.ByteBuf |
flushInternal() |
long |
getBytesWritten() |
ServletRequestContext |
getServletRequestContext() |
boolean |
isReady() |
void |
resetBuffer() |
void |
setBufferSize(int bufferSize) |
void |
setWriteListener(javax.servlet.WriteListener writeListener) |
io.netty.buffer.ByteBuf |
underlyingBuffer() |
void |
updateWritten(int len) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public ServletOutputStreamImpl(HttpServerExchange exchange)
exchange - The exchangepublic ServletOutputStreamImpl(HttpServerExchange exchange, Integer bufferSize)
public long getBytesWritten()
public void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void resetBuffer()
public void setBufferSize(int bufferSize)
public ServletRequestContext getServletRequestContext()
public io.netty.buffer.ByteBuf underlyingBuffer()
public io.netty.buffer.ByteBuf flushInternal()
throws IOException
IOExceptionpublic void updateWritten(int len)
public boolean isReady()
isReady in class javax.servlet.ServletOutputStreampublic void setWriteListener(javax.servlet.WriteListener writeListener)
setWriteListener in class javax.servlet.ServletOutputStreamCopyright © 2020 JBoss by Red Hat. All rights reserved.