public class WriteBytesProvider extends Object implements Callback
EndPoint.write(Callback, ByteBuffer...)
Callback.Adapter
Constructor and Description |
---|
WriteBytesProvider(Generator generator,
Callback flushCallback)
Create a WriteBytesProvider with specified Generator and "flush" Callback.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Force closure of write bytes
|
void |
enqueue(Frame frame,
Callback callback) |
void |
failAll(Throwable t) |
void |
failed(Throwable cause)
Callback failure.
|
int |
getBufferSize() |
ByteBuffer |
getByteBuffer()
Get the next ByteBuffer to write.
|
boolean |
isClosed()
Used to test for the final frame possible to be enqueued, the CLOSE frame.
|
void |
setBufferSize(int bufferSize)
Set the buffer size used for generating ByteBuffers from the frames.
|
void |
succeeded()
Write of ByteBuffer succeeded.
|
String |
toString() |
public WriteBytesProvider(Generator generator, Callback flushCallback)
generator
- the generator to use for converting Frame
objects to network ByteBuffer
sflushCallback
- the flush callback to call, on a write event, after the write event has been processed by this WriteBytesProvider
.
Used to trigger another flush of the next set of bytes.
public void close()
public void failAll(Throwable t)
public void failed(Throwable cause)
Conditions: for Endpoint.write() failure.
public int getBufferSize()
public ByteBuffer getByteBuffer()
public boolean isClosed()
public void setBufferSize(int bufferSize)
Value usually obtained from AbstractConnection.getInputBufferSize()
bufferSize
- the buffer size to usepublic void succeeded()
succeeded
in interface Callback
Callback.failed(Throwable)
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.