public class OutputBuffer extends Writer implements ByteChunk.ByteOutputChannel, CharChunk.CharOutputChannel
| Modifier and Type | Field and Description |
|---|---|
protected C2BConverter |
conv
Current char to byte converter.
|
static int |
DEFAULT_BUFFER_SIZE |
static String |
DEFAULT_ENCODING |
protected HashMap<String,C2BConverter> |
encoders
List of encoders.
|
| Constructor and Description |
|---|
OutputBuffer(Response response)
Default constructor.
|
OutputBuffer(Response response,
int size)
Alternate constructor which allows specifying the initial buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkConverter() |
void |
clearEncoders()
Clear cached encoders (to save memory for event requests).
|
void |
close()
Close the output buffer.
|
protected void |
doFlush(boolean realFlush)
Flush bytes or chars contained in the buffer.
|
void |
flush()
Flush bytes or chars contained in the buffer.
|
void |
flushBytes()
Real write - this buffer will be sent to the client
|
int |
getBufferSize() |
int |
getBytesWritten() |
int |
getCharsWritten() |
int |
getContentWritten() |
long |
getContentWrittenLong() |
Response |
getResponse()
Get associated Coyote response.
|
javax.servlet.WriteListener |
getWriteListener() |
boolean |
isClosed()
Is the response output closed ?
|
boolean |
isNew()
True if this buffer hasn't been used ( since recycle() ) -
i.e.
|
boolean |
isSuspended()
Is the response output suspended ?
|
protected int |
lastWrite()
Return the amount of bytes written by the lower layer.
|
void |
realWriteBytes(byte[] buf,
int off,
int cnt)
Sends the buffer data to the client output, checking the
state of Response and calling the right interceptors.
|
void |
realWriteChars(char[] buf,
int off,
int len)
Convert the chars to bytes, then send the data to the client.
|
void |
recycle()
Recycle the output buffer.
|
void |
reset() |
void |
setBufferSize(int size) |
void |
setBytesWritten(long bytesWritten) |
protected void |
setConverter() |
void |
setEncoding(String s) |
void |
setResponse(Response coyoteResponse)
Associated Coyote response.
|
void |
setSuspended(boolean suspended)
Set the suspended flag.
|
void |
setWriteListener(javax.servlet.WriteListener writeListener) |
void |
write(byte[] b,
int off,
int len) |
void |
write(char[] c) |
void |
write(char[] c,
int off,
int len) |
void |
write(int c) |
void |
write(String s) |
void |
write(String s,
int off,
int len)
Append a string to the buffer
|
void |
writeByte(int b) |
public static final String DEFAULT_ENCODING
public static final int DEFAULT_BUFFER_SIZE
protected HashMap<String,C2BConverter> encoders
protected C2BConverter conv
public OutputBuffer(Response response)
public OutputBuffer(Response response, int size)
size - Buffer size to usepublic void setResponse(Response coyoteResponse)
coyoteResponse - Associated Coyote responsepublic Response getResponse()
public boolean isSuspended()
public void setSuspended(boolean suspended)
suspended - New suspended flag valuepublic boolean isClosed()
public void recycle()
public void clearEncoders()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOException - An underlying IOException occurredpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOException - An underlying IOException occurredprotected void doFlush(boolean realFlush)
throws IOException
IOException - An underlying IOException occurredprotected int lastWrite()
public void realWriteBytes(byte[] buf,
int off,
int cnt)
throws IOException
realWriteBytes in interface ByteChunk.ByteOutputChannelbuf - Byte buffer to be written to the responseoff - Offsetcnt - LengthIOException - An underlying IOException occurredpublic void write(byte[] b,
int off,
int len)
throws IOException
IOExceptionpublic void writeByte(int b)
throws IOException
IOExceptionpublic void realWriteChars(char[] buf,
int off,
int len)
throws IOException
realWriteChars in interface CharChunk.CharOutputChannelbuf - Char buffer to be written to the responseoff - Offsetlen - LengthIOException - An underlying IOException occurredpublic void write(int c)
throws IOException
write in class WriterIOExceptionpublic void write(char[] c)
throws IOException
write in class WriterIOExceptionpublic void write(char[] c,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void write(String s, int off, int len) throws IOException
write in class WriterIOExceptionpublic void write(String s) throws IOException
write in class WriterIOExceptionpublic void setEncoding(String s)
public void checkConverter()
throws IOException
IOExceptionprotected void setConverter()
throws IOException
IOExceptionpublic void flushBytes()
throws IOException
IOExceptionpublic int getBytesWritten()
public void setBytesWritten(long bytesWritten)
public int getCharsWritten()
public int getContentWritten()
public long getContentWrittenLong()
public boolean isNew()
public void setBufferSize(int size)
public void reset()
public int getBufferSize()
public javax.servlet.WriteListener getWriteListener()
public void setWriteListener(javax.servlet.WriteListener writeListener)
Copyright © 2016 JBoss by Red Hat. All rights reserved.