A composite buffer is used to make a collection of other proton buffer instances appear as one cohesive buffer which allows the user to remain ignorant of the underlying buffer structure and in most cases does not require any special handling by the user.
More...
|
IProtonCompositeBuffer | Append (IProtonBuffer extension) |
| Appends the provided buffer to the end of the list of composite buffers already managed by this buffer. The given buffer becomes the property of the composite and the constraints placed upon buffers managed by the composite implementation are extended to this appended buffer. More...
|
|
IEnumerable< IProtonBuffer > | DecomposeBuffer () |
| Serves as a means of breaking up a composite buffer into an enumeration of the constituent buffers that is manages. Decomposing a buffer serves to consume the buffer leaving it an empty state, and the returned buffers are considered the property of the caller. More...
|
|
IProtonBuffer | Fill (byte value) |
| Fill the buffer with the given byte value. This method does not respect the read offset nor the write offset but instead fills the entire backing buffer memory with the given value. More...
|
|
IProtonBuffer | EnsureWritable (long amount) |
| Requests that the buffer ensure that there is enough allocated internal capacity such that the given number of bytes can be written without requiring additional allocations and that this amount does not exceed any total capacity restrictions for this buffer. More...
|
|
IProtonBuffer | Reset () |
| Resets the read and write offset values to zero. More...
|
|
IProtonBuffer | CopyInto (long srcPos, byte[] dest, long destPos, long length) |
| Copies the given number of bytes from this buffer into the target byte buffer starting the read from the given position in this buffer and the write to at the given position in the destination buffer. The length parameter controls how many bytes are copied to the destination. This method does not modify the read or write offset values in this buffer. More...
|
|
IProtonBuffer | CopyInto (long srcPos, IProtonBuffer dest, long destPos, long length) |
| Copies the given number of bytes from this buffer into the target byte buffer starting the read from the given position in this buffer and the write to at the given position in the destination buffer. The length parameter controls how many bytes are copied to the destination. This method does not modify the read or write offset values in this buffer nor those of the destination buffer. The destination write index is an absolute index value unrelated to the write offset of the target. More...
|
|
IProtonBuffer | Copy () |
| Returns a copy of this buffer's readable bytes. Modifying the content of the returned buffer will not affect this buffers contents. The two buffers will maintain separate offsets. The returned copy has the write offset set to the length of the copy meaning that the entire copied region is read for reading. More...
|
|
IProtonBuffer | Copy (long index, long length) |
| Returns a copy of this buffer's readable bytes. Modifying the content of the returned buffer will not affect this buffers contents. The two buffers will maintain separate offsets. The amount and start of the data to be copied is provided by the index and length arguments. The returned copy has the write offset set to the length of the copy meaning that the entire copied region is read for reading. More...
|
|
string | ToString (Encoding encoding) |
| Coverts the readable bytes in this buffer into a string value using the Encoding value provided. The underlying read and write offset values are not modified as a result of this operation. More...
|
|
IProtonBuffer | SkipBytes (long amount) |
| Advance the buffer read offset by the specified amount effectively skipping that number of bytes from being read. More...
|
|
IProtonBuffer | WriteBytes (byte[] source) |
| Writes the contents of the given byte array into this buffer and advances the write offset by the number of bytes written. More...
|
|
IProtonBuffer | WriteBytes (byte[] source, long offset, long length) |
| Writes the contents of the given byte array into this buffer and advances the write offset by the number of bytes written. More...
|
|
IProtonBuffer | WriteBytes (IProtonBuffer source) |
| Transfers the bytes from the source buffer to this buffer starting at the current write offset and continues until the source buffer becomes unreadable. The write index of this buffer is increased by the number of bytes read from the source. The method also increases the read offset of the source by the same amount as was written. More...
|
|
IProtonBuffer | Compact () |
| Discards the read bytes, and moves the buffer contents to the beginning of the buffer. More...
|
|
IProtonBuffer | Reclaim () |
| Reclaims read buffer space and returns it to the operating system or other pooling mechanisms if those are in place, then compacts the remaining buffer contents. For a non-composite buffer this operation could consist of allocating a smaller buffer to house any remaining unread bytes and freeing the larger backing buffer in some cases or it may result in a no-op depending on the buffer implementation. For the composite buffer case this operation provides an API which allows for fully read buffer constituents to be released and returned to a memory pool or back to the O/S. More...
|
|
IProtonBuffer | ReadSplit (long offset) |
| Splits the buffer into two distinct buffers at the given index plus the current read offset. The returned buffer will retain the read offset and write offset of this buffer but will be truncated to match the capacity provided by the split index, which implies that they might both be set to the capacity if they were previously set beyond the split index. The returned buffer will set its read and write offsets to zero if they fell prior to the given index otherwise they will be truncated to match the new buffer capacity. Split buffers support the standard buffer operations including resizing to ensure writable regions which implies that a buffer resize on either will cause them to no longer reference the same underlying memory region. If buffer implementations implement pooling then they must ensure proper release of shared buffer regions once both buffers no longer reference them. More...
|
|
IProtonBuffer | WriteSplit (long offset) |
| Splits the buffer into two distinct buffers at the given index plus the current write offset. The returned buffer will retain the read offset and write offset of this buffer but will be truncated to match the capacity provided by the split index, which implies that they might both be set to the capacity if they were previously set to the split index. The returned buffer will set its read and write offsets to zero if they fell prior to the given index otherwise they will be truncated to match the new buffer capacity. Split buffers support the standard buffer operations including resizing to ensure writable regions which implies that a buffer resize on either will cause them to no longer reference the same underlying memory region. If buffer implementations implement pooling then they must ensure proper release of shared buffer regions once both buffers no longer reference them. More...
|
|
IProtonBuffer | Split () |
| Splits the buffer into two buffers at the write offset. The resulting buffer will comprise the read and readable portions of this buffer with the write offset and capacity set to the current write offset. This buffer will lose access to the split region and its read offset will be set to the current write offset. This buffer will also have its capacity reduced by the number of bytes in the returned buffer (i.e. the current number of read and readable bytes). Split buffers support the standard buffer operations including resizing to ensure writable regions which implies that a buffer resize on either will cause them to no longer reference the same underlying memory region. If buffer implementations implement pooling then they must ensure proper release of shared buffer regions once both buffers no longer reference them. More...
|
|
IProtonBuffer | Split (long index) |
| Splits the buffer into two distinct buffers at the given index. The returned buffer will retain the read offset and write offset of this buffer but will be truncated to match the capacity provided by the split index, which implies that they might both be set to the capacity if they were previously set beyond the split index. The returned buffer will set its read and write offsets to zero if they fell prior to the given index otherwise they will be truncated to match the new buffer capacity. Split buffers support the standard buffer operations including resizing to ensure writable regions which implies that a buffer resize on either will cause them to no longer reference the same underlying memory region. If buffer implementations implement pooling then they must ensure proper release of shared buffer regions once both buffers no longer reference them. More...
|
|
int | ForEachReadableComponent (in int index, in Func< int, IReadableComponent, bool > processor) |
| Invokes the provided delegate for each readable component in this buffer and increments the provided index value for each invocation. The total number of buffers processed is returned to the caller. The delegate can stop processing at any time by returning false in which case this method will stop and return a negative value to indicate that processing stopped early and did not traverse all available components. More...
|
|
int | ForEachWritableComponent (in int index, in Func< int, IWritableComponent, bool > processor) |
| Invokes the provided delegate for each writable component in this buffer and increments the provided index value for each invocation. The total number of buffers processed is returned to the caller. The delegate can stop processing at any time by returning false in which case this method will stop and return a negative value to indicate that processing stopped early and did not traverse all available components. More...
|
|
bool | GetBoolean (long index) |
| Reads a single byte from the given index and returns a boolean value indicating if the byte was zero (false) or greater than zero (true). More...
|
|
sbyte | GetByte (long index) |
| Reads a single signed byte from the given index and returns it. More...
|
|
byte | GetUnsignedByte (long index) |
| Reads a single unsigned byte from the given index and returns it. More...
|
|
char | GetChar (long index) |
| Reads a single 2 byte char from the given index and returns it. More...
|
|
short | GetShort (long index) |
| Reads a single 2 byte short from the given index and returns it. More...
|
|
ushort | GetUnsignedShort (long index) |
| Reads a single 2 byte unsigned short from the given index and returns it. More...
|
|
int | GetInt (long index) |
| Reads a single 4 byte int from the given index and returns it. More...
|
|
uint | GetUnsignedInt (long index) |
| Reads a single 4 byte unsigned int from the given index and returns it. More...
|
|
long | GetLong (long index) |
| Reads a single 8 byte long from the given index and returns it. More...
|
|
ulong | GetUnsignedLong (long index) |
| Reads a single 8 byte unsigned long from the given index and returns it. More...
|
|
float | GetFloat (long index) |
| Reads a single 4 byte float from the given index and returns it. More...
|
|
double | GetDouble (long index) |
| Reads a single 8 byte double from the given index and returns it. More...
|
|
IProtonBuffer | SetByte (long index, sbyte value) |
| Write the given byte value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetUnsignedByte (long index, byte value) |
| Write the given unsigned byte value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetBoolean (long index, bool value) |
| Write the given boolean value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetChar (long index, char value) |
| Write the given 2 byte char value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetShort (long index, short value) |
| Write the given 2 byte short value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetUnsignedShort (long index, ushort value) |
| Write the given 2 byte unsigned short value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetInt (long index, int value) |
| Write the given 4 byte int value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetUnsignedInt (long index, uint value) |
| Write the given 4 byte unsigned int value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetLong (long index, long value) |
| Write the given 8 byte long value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetUnsignedLong (long index, ulong value) |
| Write the given 8 byte unsigned long value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetFloat (long index, float value) |
| Write the given 4 byte float value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
IProtonBuffer | SetDouble (long index, double value) |
| Write the given 8 byte double value at the given location in the buffer backing store without modifying the write offset of this buffer. More...
|
|
sbyte | ReadByte () |
| Read a signed byte from the buffer and advance the read offset. More...
|
|
byte | ReadUnsignedByte () |
| Read a unsigned byte from the buffer and advance the read offset. More...
|
|
bool | ReadBoolean () |
| Reads the next byte from the buffer and returns the boolean value. More...
|
|
char | ReadChar () |
| Reads the two bytes from the buffer and returns the char value. More...
|
|
short | ReadShort () |
| Reads the next two bytes from the buffer and returns the short value. More...
|
|
ushort | ReadUnsignedShort () |
| Reads the next two bytes from the buffer and returns the unsigned short value. More...
|
|
int | ReadInt () |
| Reads the next four bytes from the buffer and returns the int value. More...
|
|
uint | ReadUnsignedInt () |
| Reads the next four bytes from the buffer and returns the unsigned int value. More...
|
|
long | ReadLong () |
| Reads the next eight bytes from the buffer and returns the long value. More...
|
|
ulong | ReadUnsignedLong () |
| Reads the next eight bytes from the buffer and returns the unsigned long value. More...
|
|
float | ReadFloat () |
| Reads the next four bytes from the buffer and returns the float value. More...
|
|
double | ReadDouble () |
| Reads the next eight bytes from the buffer and returns the double value. More...
|
|
IProtonBuffer | WriteByte (sbyte value) |
| Writes the given byte value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteUnsignedByte (byte value) |
| Writes the given unsigned byte value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteBoolean (bool value) |
| Writes the given boolean value into this buffer as a single byte and increases the write offset. More...
|
|
IProtonBuffer | WriteShort (short value) |
| Writes the given two byte short value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteUnsignedShort (ushort value) |
| Writes the given two byte unsigned short value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteInt (int value) |
| Writes the given four byte int value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteUnsignedInt (uint value) |
| Writes the given four byte unsigned int value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteLong (long value) |
| Writes the given eight byte long value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteUnsignedLong (ulong value) |
| Writes the given eight byte unsigned long value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteFloat (float value) |
| Writes the given four byte float value into this buffer and increases the write offset. More...
|
|
IProtonBuffer | WriteDouble (double value) |
| Writes the given eight byte double value into this buffer and increases the write offset. More...
|
|
A composite buffer is used to make a collection of other proton buffer instances appear as one cohesive buffer which allows the user to remain ignorant of the underlying buffer structure and in most cases does not require any special handling by the user.