Class ProtonByteArrayBufferAllocator
- All Implemented Interfaces:
- AutoCloseable,- ProtonBufferAllocator
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionallocate()Create a new ProtonBuffer instance with default initial capacity.allocate(int initialCapacity) Create a new ProtonBuffer instance with the given initial capacity and the implicit growth limit should be that of the underlying buffer implementations maximum capacity limit.Create a new ProtonBuffer instance with default initial capacity.allocateHeapBuffer(int initialCapacity) Create a new ProtonBuffer instance with the given initial capacity and the implicit growth limit should be that of the underlying buffer implementations maximum capacity limit.static final ProtonBufferAllocatorvoidclose()Creates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used.composite(ProtonBuffer buffer) Creates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used.composite(ProtonBuffer[] buffers) Creates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used.copy(byte[] array, int offset, int length) Create a new ProtonBuffer that copies the given byte array using the provided offset and length values to confine the view of that array.outputBuffer(int initialCapacity) Create a new output ProtonBuffer instance with the given initial capacity and the implicit growth capacity should be that of the underlying buffer implementations limit.wrap(byte[] array, int offset, int length) Shallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.static ProtonBufferwrapped(byte[] array) Shallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.static ProtonBufferwrapped(byte[] array, int offset, int length) Shallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.buffer.ProtonBufferAllocatorcopy
- 
Constructor Details- 
ProtonByteArrayBufferAllocatorpublic ProtonByteArrayBufferAllocator()
 
- 
- 
Method Details- 
closepublic void close()- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ProtonBufferAllocator
 
- 
allocator
- 
outputBufferDescription copied from interface:ProtonBufferAllocatorCreate a new output ProtonBuffer instance with the given initial capacity and the implicit growth capacity should be that of the underlying buffer implementations limit. The buffer implementation should support growing the buffer on an as needed basis to allow writes without the user needing to code extra capacity and buffer reallocation checks.The returned buffer will be used for frame output from the Proton engine and can be a pooled buffer which the IO handler will then need to release once the buffer has been written. - Specified by:
- outputBufferin interface- ProtonBufferAllocator
- Parameters:
- initialCapacity- The initial capacity to use when creating the new ProtonBuffer.
- Returns:
- a new ProtonBuffer instance with the given initial capacity.
 
- 
allocateDescription copied from interface:ProtonBufferAllocatorCreate a new ProtonBuffer instance with default initial capacity. The buffer implementation should support growing the buffer on an as needed basis to allow writes without the user needing to code extra capacity and buffer reallocation checks.Proton buffers are closable resources and their life-span requires that they be closed upon reaching their determined end of life. - Specified by:
- allocatein interface- ProtonBufferAllocator
- Returns:
- a new ProtonBuffer instance with default initial capacity.
 
- 
allocateDescription copied from interface:ProtonBufferAllocatorCreate a new ProtonBuffer instance with the given initial capacity and the implicit growth limit should be that of the underlying buffer implementations maximum capacity limit.Proton buffers are closable resources and their life-span requires that they be closed upon reaching their determined end of life. - Specified by:
- allocatein interface- ProtonBufferAllocator
- Parameters:
- initialCapacity- The initial capacity to use when creating the new ProtonBuffer.
- Returns:
- a new ProtonBuffer instance with the given initial capacity.
 
- 
allocateHeapBufferDescription copied from interface:ProtonBufferAllocatorCreate a new ProtonBuffer instance with default initial capacity. The buffer implementation should support growing the buffer on an as needed basis to allow writes without the user needing to code extra capacity and buffer reallocation checks. The buffer allocated must be a heap buffer for cases where the buffered resource may not be easily closed and must revert to GC reclaim semantics.Proton buffers are closable resources and their life-span requires that they be closed upon reaching their determined end of life. - Specified by:
- allocateHeapBufferin interface- ProtonBufferAllocator
- Returns:
- a new ProtonBuffer instance with default initial capacity.
 
- 
allocateHeapBufferDescription copied from interface:ProtonBufferAllocatorCreate a new ProtonBuffer instance with the given initial capacity and the implicit growth limit should be that of the underlying buffer implementations maximum capacity limit. The buffer allocated must be a heap buffer for cases where the buffered resource may not be easily closed and must revert to GC reclaim semantics.Proton buffers are closable resources and their life-span requires that they be closed upon reaching their determined end of life. - Specified by:
- allocateHeapBufferin interface- ProtonBufferAllocator
- Parameters:
- initialCapacity- The initial capacity to use when creating the new ProtonBuffer.
- Returns:
- a new ProtonBuffer instance with the given initial capacity.
 
- 
copyDescription copied from interface:ProtonBufferAllocatorCreate a new ProtonBuffer that copies the given byte array using the provided offset and length values to confine the view of that array.The initial capacity of the buffer should be that of the length of the wrapped array. The returned buffer can be expanded using the normal write or expand methods. The write offset of the returned buffer will be set to the capacity. Changes to the input buffer after calling this method will not affect the contents of the returned buffer copy. - Specified by:
- copyin interface- ProtonBufferAllocator
- Parameters:
- array- the byte array to copy.
- offset- the offset into the array where the view begins.
- length- the number of bytes in the array to expose
- Returns:
- a new ProtonBufferthat is a copy of the given array.
 
- 
wrapShallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.- Parameters:
- array- The array that should be wrapped
- offset- The offset into the array where the wrapper starts
- length- The number of bytes that will be represented in the span.
- Returns:
- A ProtonBufferthat wraps the given array bytes.
 
- 
compositeDescription copied from interface:ProtonBufferAllocatorCreates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used. The created buffer will be empty and can be expanded with the normal buffer API or extended with the addition of buffers.- Specified by:
- compositein interface- ProtonBufferAllocator
- Returns:
- a new empty composite buffer instance.
 
- 
compositeDescription copied from interface:ProtonBufferAllocatorCreates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used. The created buffer will be composed of the given sequence of buffers.- Specified by:
- compositein interface- ProtonBufferAllocator
- Parameters:
- buffer- the buffers to compose
- Returns:
- a new composite buffer instance.
 
- 
compositeDescription copied from interface:ProtonBufferAllocatorCreates a new composite buffer instance that uses this allocator to create new backing space when the buffer writes exceed capacity or the ensure writable space API is used. The created buffer will be composed of the given sequence of buffers.- Specified by:
- compositein interface- ProtonBufferAllocator
- Parameters:
- buffers- the array of buffers to compose
- Returns:
- a new composite buffer instance.
 
- 
wrappedShallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.- Parameters:
- array- The array that should be wrapped
- Returns:
- A ProtonBufferthat wraps the given array bytes.
 
- 
wrappedShallow copy of the given array segment used when the caller knows that they will not share the bytes wrapped with any other application code.- Parameters:
- array- The array that should be wrapped
- offset- The offset into the array where the wrapper starts
- length- The number of bytes that will be represented in the span.
- Returns:
- A ProtonBufferthat wraps the given array bytes.
 
 
-