C# Class Amqp.ByteBuffer

A byte array wrapper that has read and write cursors.
Show file Open project: xamarin/mini-hacks Class Usage Examples

Private Properties

Property Type Description
AddReference void
ByteBuffer System
DuplicateBuffer void
ReleaseReference void
ToArraySegment ArraySegment

Public Methods

Method Description
AdjustPosition ( int offset, int length ) : void

Adjusts the read and write position.

Append ( int size ) : void

Advances the write position. As a result, length is increased by size.

ByteBuffer ( byte buffer, int offset, int count, int capacity ) : System

Initializes a new buffer from a byte array.

ByteBuffer ( int size, bool autoGrow ) : System

Initializes a new buffer of a specified size.

Complete ( int size ) : void

Advances the read position.

Reset ( ) : void

Resets read and write position to the initial state.

Seek ( int seekPosition ) : void

Sets the read position.

Shrink ( int size ) : void

Moves back the write position. As a result, length is decreased by size.

Validate ( bool write, int dataSize ) : void

Verifies that if the buffer has enough bytes for read or enough room for write and grow the buffer if needed.

Private Methods

Method Description
AddReference ( ) : void
ByteBuffer ( byte buffer, int offset, int count, int capacity, bool autoGrow ) : System
DuplicateBuffer ( int bufferSize, int dataSize, byte &buffer, int &offset, int &count ) : void
ReleaseReference ( ) : void
ToArraySegment ( ) : ArraySegment

Method Details

AdjustPosition() public method

Adjusts the read and write position.
public AdjustPosition ( int offset, int length ) : void
offset int Read position to set.
length int Length from read position to set the write position.
return void

Append() public method

Advances the write position. As a result, length is increased by size.
public Append ( int size ) : void
size int Size to advance.
return void

ByteBuffer() public method

Initializes a new buffer from a byte array.
public ByteBuffer ( byte buffer, int offset, int count, int capacity ) : System
buffer byte The byte array.
offset int The start position.
count int The number of bytes.
capacity int The total size of the byte array from offset.
return System

ByteBuffer() public method

Initializes a new buffer of a specified size.
public ByteBuffer ( int size, bool autoGrow ) : System
size int The size in bytes.
autoGrow bool If the buffer should auto-grow when a write size is larger than the buffer size.
return System

Complete() public method

Advances the read position.
public Complete ( int size ) : void
size int Size to advance.
return void

Reset() public method

Resets read and write position to the initial state.
public Reset ( ) : void
return void

Seek() public method

Sets the read position.
public Seek ( int seekPosition ) : void
seekPosition int Position to set.
return void

Shrink() public method

Moves back the write position. As a result, length is decreased by size.
public Shrink ( int size ) : void
size int
return void

Validate() public method

Verifies that if the buffer has enough bytes for read or enough room for write and grow the buffer if needed.
public Validate ( bool write, int dataSize ) : void
write bool Operation to verify. True for write and false for read.
dataSize int The size to read or write.
return void