Package org.glassfish.grizzly.memory
Class CompositeBuffer
- java.lang.Object
-
- org.glassfish.grizzly.memory.CompositeBuffer
-
- All Implemented Interfaces:
Comparable<Buffer>,WritableMessage,Buffer
- Direct Known Subclasses:
BuffersBuffer
public abstract class CompositeBuffer extends Object implements Buffer
- Author:
- Alexey Stashok
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCompositeBuffer.BulkOperationBulk Buffer operation, responsible for byte-by-byte Buffer processing.static classCompositeBuffer.DisposeOrderThe order in which internalBuffers will be disposed.static interfaceCompositeBuffer.SetterSetter.
-
Field Summary
Fields Modifier and Type Field Description protected CompositeBuffer.DisposeOrderdisposeOrder
-
Constructor Summary
Constructors Constructor Description CompositeBuffer()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanallowInternalBuffersDispose()abstract voidallowInternalBuffersDispose(boolean allow)abstract CompositeBufferappend(Buffer buffer)abstract intbulk(CompositeBuffer.BulkOperation operation)Iterates overBufferbytes fromBuffer.position()toBuffer.limit()and letsCompositeBuffer.BulkOperationexamine/change the buffer content;abstract intbulk(CompositeBuffer.BulkOperation operation, int position, int limit)Iterates overBufferbytes from position to limit and letsCompositeBuffer.BulkOperationexamine/change the buffer content;CompositeBuffer.DisposeOrderdisposeOrder()Returns the order in which internalBuffers will be disposed.CompositeBufferdisposeOrder(CompositeBuffer.DisposeOrder disposeOrder)Sets the order in which internalBuffers will be disposed.static CompositeBuffernewBuffer()Construct CompositeBuffer.static CompositeBuffernewBuffer(MemoryManager memoryManager)static CompositeBuffernewBuffer(MemoryManager memoryManager, Buffer... buffers)static CompositeBuffernewBuffer(MemoryManager memoryManager, Buffer[] buffers, boolean isReadOnly)abstract CompositeBufferprepend(Buffer buffer)Prepend data from header.position() to header.limit() to the current buffer.abstract voidremoveAll()Removes underlyingBuffers, without disposingabstract booleanreplace(Buffer oldBuffer, Buffer newBuffer)Replace one internalBufferwith 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, array, arrayOffset, asReadOnlyBuffer, capacity, clear, compact, dispose, dumpHex, duplicate, flip, get, get, get, get, get, get, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, hasArray, 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
-
-
-
-
Field Detail
-
disposeOrder
protected CompositeBuffer.DisposeOrder disposeOrder
-
-
Method Detail
-
newBuffer
public static CompositeBuffer newBuffer()
Construct CompositeBuffer.- Returns:
- new 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)
-
disposeOrder
public CompositeBuffer.DisposeOrder disposeOrder()
Returns the order in which internalBuffers will be disposed.- Returns:
CompositeBuffer.DisposeOrder
-
disposeOrder
public CompositeBuffer disposeOrder(CompositeBuffer.DisposeOrder disposeOrder)
Sets the order in which internalBuffers will be disposed.- Parameters:
disposeOrder-- Returns:
- this buffer
-
append
public abstract CompositeBuffer append(Buffer buffer)
-
prepend
public abstract CompositeBuffer prepend(Buffer buffer)
Description copied from interface:BufferPrepend data from header.position() to header.limit() to the current buffer. This will change the value returned by buffer()!
-
underlying
public abstract Object[] underlying()
Description copied from interface:BufferReturn the underlying buffer- Specified by:
underlyingin interfaceBuffer- Returns:
- the underlying buffer
-
removeAll
public abstract void removeAll()
Removes underlyingBuffers, without disposing
-
allowInternalBuffersDispose
public abstract void allowInternalBuffersDispose(boolean allow)
-
allowInternalBuffersDispose
public abstract boolean allowInternalBuffersDispose()
-
bulk
public abstract int bulk(CompositeBuffer.BulkOperation operation)
Iterates overBufferbytes fromBuffer.position()toBuffer.limit()and letsCompositeBuffer.BulkOperationexamine/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 overBufferbytes from position to limit and letsCompositeBuffer.BulkOperationexamine/change the buffer content;- Parameters:
operation-CompositeBuffer.BulkOperation- Returns:
- Buffer position the processing was stopped on, or -1, if processing reached the limit.
-
-