Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.DiffusionCore.Buffering.ByteBuffer Class Reference

This class represents a byte buffer. More...

Public Member Functions

 ByteBuffer (bool autoExpand=true)
 Creates a new ByteBuffer. More...
 
 ByteBuffer (int desiredSize, bool autoExpand=true)
 Creates a new ByteBuffer. More...
 
 ByteBuffer (byte[] buffer, bool autoExpand=true)
 Creates a new ByteBuffer. More...
 
 ByteBuffer (ByteBuffer byteBuffer)
 Creates a new ByteBuffer. More...
 
ByteBuffer Clear ()
 Resets the limit to the length and sets the position to zero. More...
 
ByteBuffer Compact ()
 Compacts this buffer. More...
 
ByteBuffer Expand (int expectedRemaining)
 Expands the buffer. More...
 
ByteBuffer Flip ()
 Sets the limit to the position, and sets the position to 0. More...
 
ByteBuffer Skip (int numBytes)
 Skips the given amount of bytes. More...
 
ByteBuffer Rewind ()
 Sets the buffer position to 0. More...
 
byte Get ()
 Retruns the byte from the current position. More...
 
sbyte GetSByte ()
 Returns the signed byte from the current position. More...
 
char GetChar ()
 Returns a character at the current position. More...
 
short GetInt16 ()
 Returns a short at the current position. More...
 
ushort GetUInt16 ()
 Returns a unsigned short at the current position. More...
 
int GetInt32 ()
 Returns a uint32 at the current position. More...
 
uint GetUInt32 ()
 Returns the unsigned integer at the current position. More...
 
long GetInt64 ()
 Returns a uint64 at the current position. More...
 
ulong GetUInt64 ()
 Returns a unsigned long from the current position. More...
 
void Get (byte[] output, int offset, int length)
 Returns a segment of bytes from the current position. More...
 
ByteBuffer Put (byte value)
 Writes a byte to the current position. More...
 
ByteBuffer Put (sbyte value)
 Writes a signed byte to the current position. More...
 
ByteBuffer Put (char value)
 Writes a character to the current position. More...
 
ByteBuffer Put (short value)
 Writes a short to the current position. More...
 
ByteBuffer Put (ushort value)
 Writes a unsigned short to the current position. More...
 
ByteBuffer Put (int value)
 Writes a integer to the current position. More...
 
ByteBuffer Put (uint value)
 Writes a unsigned integer to the current position. More...
 
ByteBuffer Put (long value)
 Writes a long to the current position. More...
 
ByteBuffer Put (ulong value)
 Writes a unsigned long to the current position. More...
 
ByteBuffer PutUtf8 (string str)
 Writes a UTF-8 encoded string to the current position. More...
 
ByteBuffer Put (byte[] input, int offset, int length)
 Writes a byte segment to the current position. More...
 
ByteBuffer GetRemainder ()
 Returns the remaining bytes in this buffer as a new buffer. More...
 
override string ToString ()
 

Public Attributes

int Remaining => limit - position
 Returns how many bytes are remaining in the buffer. More...
 
byte[] Bytes => buffer
 Returns the underlying byte array. More...
 
int Capacity => buffer.Length
 Returns the buffer capacity. More...
 
bool HasRemaining => Remaining > 0
 Returns wether the buffer has remaining bytes. More...
 

Properties

int Limit [get, set]
 Gets or sets the limit of the buffer. More...
 
int Position [get, set]
 Gets or sets the currently indexed position into the buffer. More...
 
bool IsAutoExpand [get, set]
 Gets or sets wether the buffer is auto-expanding. More...
 

Detailed Description

This class represents a byte buffer.

Constructor & Destructor Documentation

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

Creates a new ByteBuffer.

Parameters
autoExpandSets wether the buffer is expanding after it reached its limit.
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( int  desiredSize,
bool  autoExpand = true 
)

Creates a new ByteBuffer.

Parameters
desiredSizeThe initial size of the byte buffer.
autoExpandSets wether the buffer is expanding after it reached its limit.
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( byte[]  buffer,
bool  autoExpand = true 
)

Creates a new ByteBuffer.

Parameters
bufferThe backing array of the buffer.
autoExpandSets wether the buffer is expanding after it reached its limit.
PushTechnology.DiffusionCore.Buffering.ByteBuffer.ByteBuffer ( ByteBuffer  byteBuffer)

Creates a new ByteBuffer.

Parameters
byteBufferThe byte buffer to base the new instance on.

Member Function Documentation

ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Clear ( )

Resets the limit to the length and sets the position to zero.

Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Compact ( )

Compacts this buffer.

Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Expand ( int  expectedRemaining)

Expands the buffer.

Parameters
expectedRemainingThe number of bytes by which the buffer needs to grow.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Flip ( )

Sets the limit to the position, and sets the position to 0.

Returns
The current buffer instance.
byte PushTechnology.DiffusionCore.Buffering.ByteBuffer.Get ( )

Retruns the byte from the current position.

Returns
The byte on the current position.
void PushTechnology.DiffusionCore.Buffering.ByteBuffer.Get ( byte[]  output,
int  offset,
int  length 
)

Returns a segment of bytes from the current position.

Parameters
outputThe byte array to write to.
offsetThe output index that determines the start of the write.
lengthThe number of bytes to write to the output buffer.
char PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetChar ( )

Returns a character at the current position.

Returns
The character at the current position.
short PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetInt16 ( )

Returns a short at the current position.

Returns
The short at the current position.
int PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetInt32 ( )

Returns a uint32 at the current position.

Returns
The uint32 at the current position.
long PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetInt64 ( )

Returns a uint64 at the current position.

Returns
The unit64 at the current position.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetRemainder ( )

Returns the remaining bytes in this buffer as a new buffer.

Returns
The new buffer containing the remaining bytes.
sbyte PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetSByte ( )

Returns the signed byte from the current position.

Returns
The signed byte at the current position.
ushort PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetUInt16 ( )

Returns a unsigned short at the current position.

Returns
The unsigned short at the current position.
uint PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetUInt32 ( )

Returns the unsigned integer at the current position.

Returns
The unsigned integer at the current position.
ulong PushTechnology.DiffusionCore.Buffering.ByteBuffer.GetUInt64 ( )

Returns a unsigned long from the current position.

Returns
The unsigned long at the current position.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( byte  value)

Writes a byte to the current position.

Parameters
valueThe byte to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( sbyte  value)

Writes a signed byte to the current position.

Parameters
valueThe signed byte to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( char  value)

Writes a character to the current position.

Parameters
valueThe character to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( short  value)

Writes a short to the current position.

Parameters
valueThe short to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( ushort  value)

Writes a unsigned short to the current position.

Parameters
valueThe unsigned short to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( int  value)

Writes a integer to the current position.

Parameters
valueThe integer to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( uint  value)

Writes a unsigned integer to the current position.

Parameters
valueThe unsigned integer to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( long  value)

Writes a long to the current position.

Parameters
valueThe long to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( ulong  value)

Writes a unsigned long to the current position.

Parameters
valueThe unsigned long to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Put ( byte[]  input,
int  offset,
int  length 
)

Writes a byte segment to the current position.

Parameters
inputThe bytes to write to the buffer.
offsetThe start index of the segment.
lengthThe length of the segment.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.PutUtf8 ( string  str)

Writes a UTF-8 encoded string to the current position.

Parameters
valueThe UTF-8 encoded string to write.
Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Rewind ( )

Sets the buffer position to 0.

Returns
The current buffer instance.
ByteBuffer PushTechnology.DiffusionCore.Buffering.ByteBuffer.Skip ( int  numBytes)

Skips the given amount of bytes.

Parameters
numBytesThe number of bytes to skip.
Returns
The current buffer instance.

Member Data Documentation

byte [] PushTechnology.DiffusionCore.Buffering.ByteBuffer.Bytes => buffer

Returns the underlying byte array.

int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Capacity => buffer.Length

Returns the buffer capacity.

bool PushTechnology.DiffusionCore.Buffering.ByteBuffer.HasRemaining => Remaining > 0

Returns wether the buffer has remaining bytes.

int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Remaining => limit - position

Returns how many bytes are remaining in the buffer.

Property Documentation

bool PushTechnology.DiffusionCore.Buffering.ByteBuffer.IsAutoExpand
getset

Gets or sets wether the buffer is auto-expanding.

int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Limit
getset

Gets or sets the limit of the buffer.

int PushTechnology.DiffusionCore.Buffering.ByteBuffer.Position
getset

Gets or sets the currently indexed position into the buffer.


The documentation for this class was generated from the following file: