|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
ChannelBuffer | A random and sequential accessible sequence of zero or more bytes (octets). |
Class Summary | |
---|---|
AbstractChannelBuffer | A skeletal implementation of a buffer. |
ByteBufferBackedChannelBuffer | A NIO ByteBuffer based buffer. |
ChannelBuffers | Creates a new ChannelBuffer by allocating new space or by wrapping
or copying existing byte arrays, byte buffers and a string. |
DynamicChannelBuffer | A dynamic capacity buffer which increases its capacity as needed. |
HeapChannelBuffer | A skeletal implementation for Java heap buffers. |
This package is a stripped down version of org.jboss.netty.buffer, and we kept only what we needed for JBossMessaging buffers.
ChannelBuffer differs from java.nio.ByteBuffer in two ways:
- It's possible to interface almost directly with byte arrays, what is faster
- There are two positions, one for reading, and one for writing. Hence you will find methods for read, and methods for writing
Always use the static methods declared at org.jboss.messaging.core.buffers.ChannelBuffers to create the buffers you need:
buffer(int capacity) - This method will create a fixed size MessagingBuffer
dynamicBuffer(final int estimatedLength) - This method will create a SelfExpandable MessagingBuffer
dynamicBuffer(final byte[] initialBuffer) - This method will create a SelfExpandable MessagingBuffer, but reusing the initialBuffer. Be careful though, the reference will be directly used on the createdBuffer. If your buffer will be used by other operations, you should instead create a new buffer and perform a write.
buffer(final int capacity) - This method will create a fixed size MessagingBuffer
wrappedBuffer(final byte[] array) - It will wrap a byte[] on a Buffer, with writePosition at the end, and readPosition at 0
wrappedBuffer(final ByteBuffer buffer) - It will wrap a Bytebuffer on a MessagingBuffer. The position on this buffer won't affect the position on the inner buffer
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |