|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
com.sun.grizzly.tcp.http11.GrizzlyOutputBuffer
public class GrizzlyOutputBuffer
The buffer used by Tomcat response. This is a derivative of the Tomcat 3.3 OutputBuffer, with the removal of some of the state handling (which in Coyote is mostly the Processor's responsability).
| Field Summary | |
|---|---|
int |
BYTE_STATE
|
int |
CHAR_STATE
|
protected C2BConverter |
conv
Current char to byte converter. |
static int |
DEFAULT_BUFFER_SIZE
|
static String |
DEFAULT_ENCODING
|
protected HashMap |
encoders
List of encoders. |
int |
INITIAL_STATE
|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
GrizzlyOutputBuffer()
Default constructor. |
|
GrizzlyOutputBuffer(boolean chunkingDisabled)
|
|
GrizzlyOutputBuffer(int size)
Alternate constructor which allows specifying the initial buffer size. |
|
GrizzlyOutputBuffer(int size,
boolean chunkingDisabled)
|
|
| Method Summary | |
|---|---|
void |
checkConverter()
|
void |
close()
Close the output buffer. |
protected void |
doFlush(boolean realFlush)
Flush bytes or chars contained in the buffer. |
void |
enableCache(boolean enableCache)
Enable resource caching. |
void |
flush()
Flush bytes or chars contained in the buffer. |
void |
flushBytes()
Real write - this buffer will be sent to the client |
void |
flushChars()
|
boolean |
flushCharsNeeded()
|
int |
getBufferSize()
|
int |
getBytesWritten()
|
ByteBuffer |
getCachedByteBuffer()
Return a copy of the cached resources. |
int |
getCharsWritten()
|
protected boolean |
getChunkingDisabled()
Is chunking enabled/disabled? |
int |
getContentWritten()
|
Response |
getResponse()
Get associated Coyote response. |
boolean |
isNew()
True if this buffer hasn't been used ( since recycle() ) - i.e. |
boolean |
isSupportFileSend()
Returns true, if OutputBuffer supports file-send mode,
or false otherwise. |
boolean |
isSuspended()
Is the response output suspended ? |
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[] c,
int off,
int len)
Send the bytes ( usually the internal conversion buffer ). |
void |
recycle()
Recycle the output buffer. |
void |
reset()
|
long |
sendFile(FileChannel fileChannel,
long position,
long length)
Transfers data from file channel to the socket channel directly. |
void |
setBufferSize(int size)
|
protected void |
setChunkingDisabled(boolean chunkingDisabled)
Enabled or Disable response chunking. |
protected void |
setConverter()
|
void |
setEncoding(String s)
|
void |
setResponse(Response response)
Associated Coyote response. |
void |
setSuspended(boolean suspended)
Set the suspended flag. |
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(StringBuffer sb)
|
void |
write(String s,
int off,
int len)
Append a string to the buffer |
void |
writeByte(int b)
|
| Methods inherited from class java.io.Writer |
|---|
append, append, append |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DEFAULT_ENCODING
public static final int DEFAULT_BUFFER_SIZE
public final int INITIAL_STATE
public final int CHAR_STATE
public final int BYTE_STATE
protected HashMap encoders
protected C2BConverter conv
| Constructor Detail |
|---|
public GrizzlyOutputBuffer()
public GrizzlyOutputBuffer(boolean chunkingDisabled)
public GrizzlyOutputBuffer(int size)
size - Buffer size to use
public GrizzlyOutputBuffer(int size,
boolean chunkingDisabled)
| Method Detail |
|---|
protected void setChunkingDisabled(boolean chunkingDisabled)
chunkingDisabled - protected boolean getChunkingDisabled()
public void setResponse(Response response)
response - Associated Coyote responsepublic Response getResponse()
public boolean isSuspended()
public void setSuspended(boolean suspended)
suspended - New suspended flag valuepublic void recycle()
public void close()
throws IOException
close in interface Closeableclose in class WriterIOException - An underlying IOException occurred
public void flush()
throws IOException
flush in interface Flushableflush in class WriterIOException - An underlying IOException occurred
protected void doFlush(boolean realFlush)
throws IOException
IOException - An underlying IOException occurred
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 - Length
IOException - An underlying IOException occurred
public void write(byte[] b,
int off,
int len)
throws IOException
IOException
public void writeByte(int b)
throws IOException
IOException
public void write(int c)
throws IOException
write in class WriterIOException
public void write(char[] c)
throws IOException
write in class WriterIOException
public void write(char[] c,
int off,
int len)
throws IOException
write in class WriterIOException
public void write(StringBuffer sb)
throws IOException
IOException
public void write(String s,
int off,
int len)
throws IOException
write in class WriterIOException
public void write(String s)
throws IOException
write in class WriterIOException
public void flushChars()
throws IOException
IOExceptionpublic boolean flushCharsNeeded()
public void setEncoding(String s)
public void realWriteChars(char[] c,
int off,
int len)
throws IOException
CharChunk.CharOutputChannel
realWriteChars in interface CharChunk.CharOutputChannelIOException
public void checkConverter()
throws IOException
IOException
protected void setConverter()
throws IOException
IOException
public void flushBytes()
throws IOException
IOExceptionpublic int getBytesWritten()
public int getCharsWritten()
public int getContentWritten()
public boolean isNew()
public void setBufferSize(int size)
public void reset()
public int getBufferSize()
public void enableCache(boolean enableCache)
public ByteBuffer getCachedByteBuffer()
public boolean isSupportFileSend()
OutputBuffer supports file-send mode,
or false otherwise.
isSupportFileSend in interface FileOutputBufferOutputBuffer supports file-send mode,
or false otherwise.
public long sendFile(FileChannel fileChannel,
long position,
long length)
throws IOException
sendFile in interface FileOutputBufferfileChannel - FileChannelposition - The position within the file at which the transfer is
to begin; must be non-negativelength - The maximum number of bytes to be transferred;
must be non-negative
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||