public class ChannelBufferOutput extends java.lang.Object implements MessageBufferOutput
MessageBufferOutput adapter for WritableByteChannel| Constructor and Description |
|---|
ChannelBufferOutput(java.nio.channels.WritableByteChannel channel) |
ChannelBufferOutput(java.nio.channels.WritableByteChannel channel,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(byte[] buffer,
int offset,
int length)
Writes an external payload data.
|
void |
close() |
void |
flush() |
MessageBuffer |
next(int mimimumSize)
Allocates the next buffer for writing message packed data.
|
java.nio.channels.WritableByteChannel |
reset(java.nio.channels.WritableByteChannel channel)
Reset channel.
|
void |
write(byte[] buffer,
int offset,
int length)
Writes an external payload data.
|
void |
writeBuffer(int length)
Flushes the previously allocated buffer.
|
public ChannelBufferOutput(java.nio.channels.WritableByteChannel channel)
public ChannelBufferOutput(java.nio.channels.WritableByteChannel channel,
int bufferSize)
public java.nio.channels.WritableByteChannel reset(java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
channel - new channeljava.io.IOExceptionpublic MessageBuffer next(int mimimumSize) throws java.io.IOException
MessageBufferOutputnext in interface MessageBufferOutputmimimumSize - the mimium required buffer size to allocatejava.io.IOExceptionpublic void writeBuffer(int length)
throws java.io.IOException
MessageBufferOutputwriteBuffer in interface MessageBufferOutputlength - the size of buffer to flushjava.io.IOExceptionpublic void write(byte[] buffer,
int offset,
int length)
throws java.io.IOException
MessageBufferOutputwrite in interface MessageBufferOutputbuffer - the data to writeoffset - the start offset in the datalength - the number of bytes to writejava.io.IOExceptionpublic void add(byte[] buffer,
int offset,
int length)
throws java.io.IOException
MessageBufferOutputadd in interface MessageBufferOutputbuffer - the data to addoffset - the start offset in the datalength - the number of bytes to addjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOException