XNIO API 3.0.4.GA

org.xnio.streams
Interface BufferPipeOutputStream.BufferWriter

All Superinterfaces:
Flushable
Enclosing class:
BufferPipeOutputStream

public static interface BufferPipeOutputStream.BufferWriter
extends Flushable

A buffer writer for an BufferPipeOutputStream.


Method Summary
 void accept(Pooled<ByteBuffer> pooledBuffer, boolean eof)
          Accept a buffer.
 void flush()
          Flushes this stream by writing any buffered output to the underlying stream.
 Pooled<ByteBuffer> getBuffer(boolean firstBuffer)
          Get a new buffer to be filled.
 

Method Detail

getBuffer

Pooled<ByteBuffer> getBuffer(boolean firstBuffer)
                             throws IOException
Get a new buffer to be filled. The new buffer may, for example, include a prepended header. This method may block until a buffer is available or until some other condition, such as flow control, is met.

Parameters:
firstBuffer - true if this is the first buffer in the stream, false otherwise
Returns:
the new buffer
Throws:
IOException - if an I/O error occurs

accept

void accept(Pooled<ByteBuffer> pooledBuffer,
            boolean eof)
            throws IOException
Accept a buffer. If this is the last buffer that will be sent, the eof flag will be set to true. This method should block until the entire buffer is consumed, or an error occurs. This method may also block until some other condition, such as flow control, is met.

Parameters:
pooledBuffer - the buffer to send
eof - true if this is the last buffer which will be sent
Throws:
IOException - if an I/O error occurs

flush

void flush()
           throws IOException
Flushes this stream by writing any buffered output to the underlying stream. This method should block until the data is fully flushed. This method may also block until some other condition, such as flow control, is met.

Specified by:
flush in interface Flushable
Throws:
IOException - If an I/O error occurs

XNIO API 3.0.4.GA

Copyright © 2010 JBoss, a division of Red Hat, Inc.