#include <coherence/io/AbstractWriteBuffer.hpp>
Inherits Object, and WriteBuffer.
Inherited by DelegatingWriteBuffer, and OctetArrayWriteBuffer.
This implementation is explicitly not thread-safe.
Public Types | |||||||||||||
typedef spec::Handle | Handle | ||||||||||||
AbstractWriteBuffer Handle definition. | |||||||||||||
typedef spec::View | View | ||||||||||||
AbstractWriteBuffer View definition. | |||||||||||||
typedef spec::Holder | Holder | ||||||||||||
AbstractWriteBuffer Holder definition. | |||||||||||||
typedef this_spec::Handle | Handle | ||||||||||||
WriteBuffer Handle definition. | |||||||||||||
typedef this_spec::View | View | ||||||||||||
WriteBuffer View definition. | |||||||||||||
typedef this_spec::Holder | Holder | ||||||||||||
WriteBuffer Holder definition. | |||||||||||||
typedef TypedHandle < const coherence::util::Binary > | BinaryView | ||||||||||||
Binary View definition. | |||||||||||||
Public Member Functions | |||||||||||||
virtual size32_t | getMaximumCapacity () const | ||||||||||||
Determine the maximum number of octets that the buffer can hold. If the maximum size is greater than the current size, then the buffer is expected to resize itself as necessary up to the maximum size in order to contain the data given to it.
| |||||||||||||
virtual void | write (size32_t ofDest, Array< octet_t >::View vabSrc) | ||||||||||||
Store the specified octets at the specified offset within the buffer. For purposes of side-effects and potential exceptions, this method is functionally equivalent to the following code:
| |||||||||||||
virtual void | write (size32_t ofDest, ReadBuffer::View vBufSrc) | ||||||||||||
Store the contents of the specified ReadBuffer at the specified offset within this buffer. For purposes of side-effects and potential exceptions, this method is functionally equivalent to the following code:
| |||||||||||||
virtual void | write (size32_t ofDest, ReadBuffer::View vBufSrc, size32_t ofSrc, size32_t cbSrc) | ||||||||||||
Store the specified portion of the contents of the specified ReadBuffer at the specified offset within this buffer. For purposes of side-effects and potential exceptions, this method is functionally equivalent to the following code:
| |||||||||||||
virtual void | retain (size32_t of) | ||||||||||||
Starting with the octet at offset of , retain the remainder of this WriteBuffer, such that the octet at offset of is shifted to offset 0, the octet at offset of + 1 is shifted to offset 1, and so on up to the octet at offset length() - 1 , which is shifted to offset length() - of - 1 .
After this method, the length of of the buffer as indicated by the length() method will be equal to This method is functionally equivalent to the following code:
| |||||||||||||
virtual void | clear () | ||||||||||||
Set the length of the buffer as indicated by the length() method to zero.
The effect on the capacity of the buffer is implementation-specific; some implementations are expected to retain the same capacity while others are expected to shrink accordingly. | |||||||||||||
virtual WriteBuffer::Handle | getWriteBuffer (size32_t of) | ||||||||||||
Obtain a WriteBuffer starting at a particular offset within this WriteBuffer.
This is functionally equivalent to:
| |||||||||||||
virtual WriteBuffer::Handle | getWriteBuffer (size32_t of, size32_t cb) | ||||||||||||
Obtain a WriteBuffer for a portion of this WriteBuffer.
Use of the resulting buffer will correspond to using this buffer directly but with the offset being passed to the buffer methods automatically having
Note that the resulting WriteBuffer is limited in the number of octets that can be written to it; in other words, its
| |||||||||||||
virtual ReadBuffer::View | getReadBuffer () const | ||||||||||||
Get a ReadBuffer object that is a snapshot of this WriteBuffer's data. This method is functionally equivalent to the following code:
| |||||||||||||
virtual Array < octet_t >::View | toOctetArray () const | ||||||||||||
Returns an octet array that holds the complete contents of this WriteBuffer. This method is functionally equivalent to the following code:
| |||||||||||||
virtual BinaryView | toBinary () const | ||||||||||||
Returns a new Binary object that holds the complete contents of this WriteBuffer. This method is functionally equivalent to the following code:
| |||||||||||||
virtual BufferOutput::Handle | getBufferOutput (size32_t of=0) | ||||||||||||
Get a BufferOutput object to write data to this buffer starting at a particular offset. Note that each call to this method will return a new BufferOutput object, with the possible exception being that a zero-length non-resizing WriteBuffer could always return the same instance (since it is not writable).
| |||||||||||||
virtual BufferOutput::Handle | getAppendingBufferOutput () | ||||||||||||
Get a BufferOutput object to write data to this buffer. The BufferOutput object returned by this method is set to append to the WriteBuffer, meaning that its offset is pre-set to the length() of this buffer. This is functionally equivalent to:
| |||||||||||||
Protected Member Functions | |||||||||||||
virtual BufferOutput::Handle | instantiateBufferOutput () | ||||||||||||
Factory method: Instantiate a BufferOutput object to write data to the WriteBuffer. | |||||||||||||
virtual Array < octet_t >::Handle | tmpbuf () | ||||||||||||
Get a small buffer for formating data. | |||||||||||||
virtual Array < octet_t >::Handle | tmpbuf (size32_t cb) | ||||||||||||
Get a buffer for formating data. | |||||||||||||
Protected Attributes | |||||||||||||
MemberHandle< Array < octet_t > > | m_habBuf | ||||||||||||
A temp buffer to use for building the data to write. | |||||||||||||
Classes | |||||||||||||
class | AbstractBufferOutput | ||||||||||||
AbstractBufferOutput is a concrete implementation of BufferOutput for the non-concrete AbstractWriteBuffer implementation. More... |
virtual BufferOutput::Handle instantiateBufferOutput | ( | ) | [protected, virtual] |
Factory method: Instantiate a BufferOutput object to write data to the WriteBuffer.
Reimplemented in DelegatingWriteBuffer, and OctetArrayWriteBuffer.
Get a small buffer for formating data.
Get a buffer for formating data.
cb | the minimum size for the buffer |
cb
octets long