|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.web.container.http11.InternalOutputBuffer
org.glassfish.grizzly.web.SocketChannelOutputBuffer
public class SocketChannelOutputBuffer
Output buffer.
Buffer the bytes until the ByteChunk is full or the request
is completed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.glassfish.grizzly.web.container.http11.InternalOutputBuffer |
|---|
InternalOutputBuffer.OutputStreamOutputBuffer |
| Field Summary | |
|---|---|
protected static Buffer |
ACK
ACK static bytes. |
protected StreamWriter |
connectionStreamWriter
StreamWriter, which will be used to write data. |
protected static Logger |
logger
|
protected static int |
MAX_BUFFERED_BYTES
Maximum cached bytes before flushing. |
protected static int |
maxBufferedBytes
Default max cached bytes. |
protected Buffer |
outputBuffer
Underlying Buffer |
| Fields inherited from class org.glassfish.grizzly.web.container.http11.InternalOutputBuffer |
|---|
activeFilters, buf, committed, filterLibrary, finished, headers, lastActiveFilter, outputStream, outputStreamOutputBuffer, pos, response, socketBuffer, useSocketBuffer |
| Constructor Summary | |
|---|---|
SocketChannelOutputBuffer(Response response,
int headerBufferSize,
boolean useSocketBuffer)
Alternate constructor. |
|
| Method Summary | |
|---|---|
protected Buffer |
createBuffer(int size)
Create the output Buffer |
void |
endRequest()
End request. |
void |
flush()
Flush the buffered bytes, |
void |
flushBuffer()
Writes bytes to the underlying channel. |
void |
flushChannel(Buffer bb)
Flush the buffer by looping until the ByteBuffer is empty |
StreamWriter |
getStreamWriter()
Return the underlying StreamWriter. |
boolean |
isAsyncHttpWriteEnabled()
Is async HTTP write enabled. |
boolean |
isSupportFileSend()
Returns true, if OutputBuffer supports file-send mode,
or false otherwise. |
void |
realWriteBytes(byte[] cbuf,
int off,
int len)
Callback to write data from the buffer. |
void |
recycle()
Recycle the output buffer. |
void |
reset()
Reset current response. |
void |
sendAck()
Send an acknoledgement without buffering. |
long |
sendFile(FileChannel fileChannel,
long position,
long length)
Transfers data from file channel to the socket channel directly. |
void |
setAsyncHttpWriteEnabled(boolean isAsyncHttpWriteEnabled)
Set if async HTTP write enabled. |
void |
setStreamWriter(StreamWriter streamWriter)
Set the underlying StreamWriter. |
| Methods inherited from class org.glassfish.grizzly.web.container.http11.InternalOutputBuffer |
|---|
addActiveFilter, addFilter, addLastOutputFilter, clearFilters, commit, doWrite, endHeaders, getFilters, getOutputStream, nextRequest, sendHeader, sendHeader, sendHeader, sendStatus, setOutputStream, setSocketBuffer, write, write, write, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Logger logger
protected StreamWriter connectionStreamWriter
StreamWriter, which will be used to write data.
protected Buffer outputBuffer
Buffer
protected static final Buffer ACK
protected static final int MAX_BUFFERED_BYTES
protected static int maxBufferedBytes
| Constructor Detail |
|---|
public SocketChannelOutputBuffer(Response response,
int headerBufferSize,
boolean useSocketBuffer)
| Method Detail |
|---|
protected Buffer createBuffer(int size)
Buffer
public void setStreamWriter(StreamWriter streamWriter)
StreamWriter.
public StreamWriter getStreamWriter()
StreamWriter.
public boolean isAsyncHttpWriteEnabled()
public void setAsyncHttpWriteEnabled(boolean isAsyncHttpWriteEnabled)
isAsyncHttpWriteEnabled - true, if async HTTP write
enabled, or false otherwise.
public void sendAck()
throws IOException
sendAck in class InternalOutputBufferIOException
public void realWriteBytes(byte[] cbuf,
int off,
int len)
throws IOException
realWriteBytes in interface ByteChunk.ByteOutputChannelrealWriteBytes in class InternalOutputBufferIOException
public void flushChannel(Buffer bb)
throws IOException
ByteBuffer is empty
bb - the ByteBuffer to write.
IOExceptionpublic 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
public void flush()
throws IOException
flush in class InternalOutputBufferIOException - an undelying I/O error occured
public void endRequest()
throws IOException
endRequest in class InternalOutputBufferIOException - an undelying I/O error occured
public void flushBuffer()
throws IOException
IOExceptionpublic void recycle()
recycle in class InternalOutputBufferpublic void reset()
reset in class InternalOutputBufferIllegalStateException - if the response has already been committed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||