org.glassfish.grizzly.memory
Class CompositeBuffer

java.lang.Object
  extended by org.glassfish.grizzly.memory.CompositeBuffer
All Implemented Interfaces:
Comparable<Buffer>, Appendable<Buffer>, WritableMessage, Buffer
Direct Known Subclasses:
BuffersBuffer

public abstract class CompositeBuffer
extends Object
implements Buffer, Appendable<Buffer>

Author:
Alexey Stashok

Nested Class Summary
static interface CompositeBuffer.BulkOperation
          Bulk Buffer operation, responsible for byte-by-byte Buffer processing.
static interface CompositeBuffer.Setter
          Setter.
 
Constructor Summary
CompositeBuffer()
           
 
Method Summary
abstract  boolean allowInternalBuffersDispose()
           
abstract  void allowInternalBuffersDispose(boolean allow)
           
abstract  int bulk(CompositeBuffer.BulkOperation operation)
          Iterates over Buffer bytes from Buffer.position() to Buffer.limit() and lets CompositeBuffer.BulkOperation examine/change the buffer content;
abstract  int bulk(CompositeBuffer.BulkOperation operation, int position, int limit)
          Iterates over Buffer bytes from position to limit and lets CompositeBuffer.BulkOperation examine/change the buffer content;
static CompositeBuffer newBuffer()
          Construct CompositeBuffer.
static CompositeBuffer newBuffer(MemoryManager memoryManager)
           
static CompositeBuffer newBuffer(MemoryManager memoryManager, Buffer... buffers)
           
static CompositeBuffer newBuffer(MemoryManager memoryManager, Buffer[] buffers, boolean isReadOnly)
           
abstract  CompositeBuffer prepend(Buffer buffer)
          Prepend data from header.position() to header.limit() to the current buffer.
abstract  void removeAll()
          Removes underlying Buffers, without disposing
abstract  boolean replace(Buffer oldBuffer, Buffer newBuffer)
          Replace one internal Buffer with another one.
abstract  Object[] underlying()
          Return the underlying buffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.grizzly.Buffer
allowBufferDispose, allowBufferDispose, asReadOnlyBuffer, capacity, clear, compact, dispose, duplicate, flip, get, get, get, get, get, get, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, hasRemaining, isComposite, isDirect, isReadOnly, limit, limit, mark, order, order, position, position, put, put, put, put, put, put, put, put, put8BitString, putChar, putChar, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, remaining, reset, rewind, shrink, slice, slice, split, toBufferArray, toBufferArray, toBufferArray, toBufferArray, toByteBuffer, toByteBuffer, toByteBufferArray, toByteBufferArray, toByteBufferArray, toByteBufferArray, toStringContent, toStringContent, toStringContent, trim, tryDispose
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.glassfish.grizzly.asyncqueue.WritableMessage
isExternal, release
 
Methods inherited from interface org.glassfish.grizzly.Appendable
append
 

Constructor Detail

CompositeBuffer

public CompositeBuffer()
Method Detail

newBuffer

public static CompositeBuffer newBuffer()
Construct CompositeBuffer.


newBuffer

public static CompositeBuffer newBuffer(MemoryManager memoryManager)

newBuffer

public static CompositeBuffer newBuffer(MemoryManager memoryManager,
                                        Buffer... buffers)

newBuffer

public static CompositeBuffer newBuffer(MemoryManager memoryManager,
                                        Buffer[] buffers,
                                        boolean isReadOnly)

prepend

public abstract CompositeBuffer prepend(Buffer buffer)
Description copied from interface: Buffer
Prepend data from header.position() to header.limit() to the current buffer. This will change the value returned by buffer()!

Specified by:
prepend in interface Buffer

underlying

public abstract Object[] underlying()
Description copied from interface: Buffer
Return the underlying buffer

Specified by:
underlying in interface Buffer
Returns:
the underlying buffer

removeAll

public abstract void removeAll()
Removes underlying Buffers, without disposing


allowInternalBuffersDispose

public abstract void allowInternalBuffersDispose(boolean allow)

allowInternalBuffersDispose

public abstract boolean allowInternalBuffersDispose()

bulk

public abstract int bulk(CompositeBuffer.BulkOperation operation)
Iterates over Buffer bytes from Buffer.position() to Buffer.limit() and lets CompositeBuffer.BulkOperation examine/change the buffer content;

Parameters:
operation - CompositeBuffer.BulkOperation
Returns:
Buffer position the processing was stopped on, or -1, if processing reached the limit.

bulk

public abstract int bulk(CompositeBuffer.BulkOperation operation,
                         int position,
                         int limit)
Iterates over Buffer bytes from position to limit and lets CompositeBuffer.BulkOperation examine/change the buffer content;

Parameters:
operation - CompositeBuffer.BulkOperation
Returns:
Buffer position the processing was stopped on, or -1, if processing reached the limit.

replace

public abstract boolean replace(Buffer oldBuffer,
                                Buffer newBuffer)
Replace one internal Buffer with another one.

Parameters:
oldBuffer - the Buffer to replace.
newBuffer - the new Buffer.
Returns:
true, if the oldBuffer was found and replaced, or false otherwise.


Copyright © 2012 Oracle Corporation. All Rights Reserved.