Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Buffering.ByteBuffer Class Reference

This class represents a byte buffer. More...

Inheritance diagram for PushTechnology.DiffusionCore.Buffering.ByteBuffer:
PushTechnology.DiffusionCore.Buffering.ByteBufferBase PushTechnology.DiffusionCore.Buffering.MessageByteBuffer

Public Member Functions

 ByteBuffer ()
 Constructor. More...
 
 ByteBuffer (bool autoExpand)
 Constructor. More...
 
 ByteBuffer (int desiredSize)
 Constructor. More...
 
 ByteBuffer (int desiredSize, bool autoExpand)
 Constructor. More...
 
 ByteBuffer (byte[] buffer)
 Constructs a new ByteBuffer object without incrementing the position. More...
 
 ByteBuffer (byte[] buffer, bool setPosition, bool autoExpand)
 Constructor. More...
 
 ByteBuffer (ByteBuffer buffer)
 Creates a ByteBuffer from a source ByteBuffer. More...
 
 ByteBuffer (byte[] buffer, int desiredSize)
 Creates a ByteBuffer from an array of bytes of the desired size. Note: does not increment the current position. More...
 
 ByteBuffer (object expand)
 Constructor. More...
 
override string ToString ()
 
ByteBuffer GetRemainder ()
 Returns the remaining bytes in this buffer as a new buffer. It would be prudent to call 'HasRemaining' prior to calling this. More...
 
string ToHexString ()
 Return a string summarizing the state of this buffer. More...
 
string ToDecimalString ()
 Returns a string representing the decimal values of this ByteBuffer. More...
 
bool Contains (byte byteToFind)
 Helper method to scan the byte array for a particular byte. More...
 
ByteBuffer AsReadOnlyBuffer ()
 Creates a readonly version of the current byte buffer. More...
 
- Public Member Functions inherited from PushTechnology.DiffusionCore.Buffering.ByteBufferBase
virtual void Acquire ()
 
ByteBufferBase Clear ()
 Resets the limit to the length and sets the position to zero. More...
 
ByteBufferBase Compact ()
 Compact this buffer. More...
 
ByteBufferBase Expand (int expectedRemaining)
 Expand the buffer. More...
 
ByteBufferBase Expand (int position, int expectedRemaining)
 Expand the buffer. More...
 
ByteBufferBase Flip ()
 Sets the limit to the position, and sets the position to 0. More...
 
byte Get ()
 Gets the byte from the current position. More...
 
byte Get (int position)
 Gets the byte at a given position. More...
 
void Get (byte[] buffer)
 Gets the buffer. More...
 
void Get (byte[] buffer, int offset, int length)
 Gets the buffer. More...
 
void Get (int position, byte[] buffer, int offset, int length)
 Gets the buffer. More...
 
void Get (int position, ByteBuffer buffer, int offset, int length)
 Gets the buffer. More...
 
char GetChar ()
 Gets a character at the current position. More...
 
char GetChar (int position)
 Gets a character at a given position. More...
 
string GetHexDump ()
 Gets a hexadecimal dump of this buffer. More...
 
short GetInt16 ()
 Gets a short at the current position. More...
 
short GetInt16 (int position)
 Gets a short at a given position. More...
 
int GetInt32 ()
 Gets a uint32 at the current position. More...
 
int GetInt32 (int position)
 Gets a uint32 at a given position. More...
 
long GetInt64 ()
 Gets a uint64 at the current position. More...
 
long GetInt64 (int position)
 Gets a uint64 at a given position. More...
 
sbyte GetSByte ()
 
sbyte GetSByte (int position)
 
ushort GetUInt16 ()
 
ushort GetUInt16 (int position)
 
uint GetUInt32 ()
 
uint GetUInt32 (int position)
 
ulong GetUInt64 ()
 
ulong GetUInt64 (int position)
 
ByteBufferBase Put (params byte[] data)
 
ByteBufferBase PutRange (byte[] data)
 
ByteBufferBase PutRange (byte[] data, bool incrementPosition)
 
ByteBufferBase Put (ByteBufferBase data)
 
ByteBufferBase Put (byte value)
 
ByteBufferBase Put (char value)
 
ByteBufferBase PutUtf8 (string str)
 
ByteBufferBase Put (short value)
 
ByteBufferBase Put (int value)
 
ByteBufferBase Put (long value)
 
ByteBufferBase Put (sbyte value)
 
ByteBufferBase Put (ushort value)
 
ByteBufferBase Put (uint value)
 
ByteBufferBase Put (ulong value)
 
ByteBufferBase Put (byte[] buffer, bool incrementPosition)
 
ByteBufferBase Put (int position, ByteBufferBase data)
 
ByteBufferBase Put (int position, byte value)
 
ByteBufferBase Put (int position, char value)
 
ByteBufferBase Put (int position, short value)
 
ByteBufferBase Put (int position, int value)
 
ByteBufferBase Put (int position, long value)
 
ByteBufferBase Put (int position, sbyte value)
 
ByteBufferBase Put (int position, ushort value)
 
ByteBufferBase Put (int position, uint value)
 
ByteBufferBase Put (int position, ulong value)
 
ByteBufferBase Put (byte[] buffer, int offset, int length, bool incrementPosition=true)
 
ByteBufferBase Put (int position, byte[] buffer, int offset, int length)
 
virtual void Release ()
 
ByteBufferBase Rewind ()
 
ByteBufferBase Skip (int numBytes)
 
ByteBufferBase Slice ()
 
override string ToString ()
 

Static Public Member Functions

static ByteBuffer Allocate (int capacity)
 Allocate memory for a buffer. More...
 
static ByteBuffer Wrap (byte[] buffer, bool setPosition=false, bool autoExpand=false)
 
- Static Public Member Functions inherited from PushTechnology.DiffusionCore.Buffering.ByteBufferBase
static void SetAllocator (IByteBufferAllocator allocator)
 

Protected Member Functions

override void DoCompact ()
 
override byte DoReadByte (int position)
 
override void DoReadBytes (int position, byte[] dest, int offset, int length)
 
override void DoResize (int newSize)
 
override void DoWrite (int position, byte value)
 
override void DoWrite (int position, byte[] src, int offset, int length)
 

Properties

byte this[int index] [get]
 Returns a byte at the given index. More...
 
override byte[] Bytes [get]
 
override int Length [get]
 
override int Capacity [get]
 
- Properties inherited from PushTechnology.DiffusionCore.Buffering.ByteBufferBase
abstract byte[] Bytes [get]
 Get the bytes in the buffer. More...
 
abstract int Length [get]
 Get the number of bytes in the buffer. More...
 
abstract int Capacity [get]
 Get the capacity of the buffer. More...
 
bool HasRemaining [get]
 Do we have any bytes remaining? More...
 
bool IsAutoExpand [get, set]
 Is this an auto-expanding buffer? More...
 
int Limit [get, set]
 Get/set the limit of the buffer. More...
 
int Position [get, set]
 Get/set the currently indexed position into the buffer. More...
 
int Remaining [get]
 Returns how many bytes are remaining in the buffer. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from PushTechnology.DiffusionCore.Buffering.ByteBufferBase
static IByteBufferAllocator THE_ALLOCATOR = new ByteBufferAllocator()
 The byte buffer allocator. More...
 

Detailed Description

This class represents a byte buffer.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( )

Constructor.

PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( bool  autoExpand)

Constructor.

Parameters
autoExpand
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( int  desiredSize)

Constructor.

Parameters
desiredSize
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( int  desiredSize,
bool  autoExpand 
)

Constructor.

Parameters
desiredSize
autoExpand
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( byte[]  buffer)

Constructs a new ByteBuffer object without incrementing the position.

Parameters
buffer
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( byte[]  buffer,
bool  setPosition,
bool  autoExpand 
)

Constructor.

Parameters
buffer
setPosition
autoExpand
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( ByteBuffer  buffer)

Creates a ByteBuffer from a source ByteBuffer.

Parameters
buffer
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( byte[]  buffer,
int  desiredSize 
)

Creates a ByteBuffer from an array of bytes of the desired size. Note: does not increment the current position.

Parameters
buffer
desiredSize
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( object  expand)

Constructor.

Parameters
expand

Member Function Documentation

static ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Allocate ( int  capacity)
static

Allocate memory for a buffer.

Parameters
capacityThe number of bytes to allocate.
Returns
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.AsReadOnlyBuffer ( )

Creates a readonly version of the current byte buffer.

Returns
The readonly version of that byte buffer.
bool PushTechnology.DiffusionCore.Buffering.ByteBuffer.Contains ( byte  byteToFind)

Helper method to scan the byte array for a particular byte.

Parameters
byteToFind
Returns
override void PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoCompact ( )
protectedvirtual
override byte PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoReadByte ( int  position)
protectedvirtual

Parameters
position
Returns

Implements PushTechnology.DiffusionCore.Buffering.ByteBufferBase.

override void PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoReadBytes ( int  position,
byte[]  dest,
int  offset,
int  length 
)
protectedvirtual

Parameters
position
dest
offset
length

Implements PushTechnology.DiffusionCore.Buffering.ByteBufferBase.

override void PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoResize ( int  newSize)
protectedvirtual
override void PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoWrite ( int  position,
byte  value 
)
protectedvirtual

Parameters
position
value

Implements PushTechnology.DiffusionCore.Buffering.ByteBufferBase.

override void PushTechnology.DiffusionCore.Buffering.ByteBuffer.DoWrite ( int  position,
byte[]  src,
int  offset,
int  length 
)
protectedvirtual

Parameters
position
src
offset
length

Implements PushTechnology.DiffusionCore.Buffering.ByteBufferBase.

ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetRemainder ( )

Returns the remaining bytes in this buffer as a new buffer. It would be prudent to call 'HasRemaining' prior to calling this.

Returns
string PushTechnology.DiffusionCore.Buffering.ByteBuffer.ToDecimalString ( )

Returns a string representing the decimal values of this ByteBuffer.

Returns
string PushTechnology.DiffusionCore.Buffering.ByteBuffer.ToHexString ( )

Return a string summarizing the state of this buffer.

Returns
A summary string.
override string PushTechnology.DiffusionCore.Buffering.ByteBuffer.ToString ( )

Returns
static ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Wrap ( byte[]  buffer,
bool  setPosition = false,
bool  autoExpand = false 
)
static

Parameters
buffer
setPosition
autoExpand
Returns

Property Documentation

override byte [] PushTechnology.DiffusionCore.Buffering.ByteBuffer.Bytes
get

override int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Capacity
get

override int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Length
get

byte PushTechnology.DiffusionCore.Buffering.ByteBuffer.this[int index]
get

Returns a byte at the given index.

Parameters
index
Returns