Show / Hide Table of Contents

Class ByteBuffer

A byte array wrapper that has a read and a write cursor.

Inheritance
System.Object
ByteBuffer
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Amqp
Assembly: Amqp.Net.dll
Syntax
public class ByteBuffer

Constructors

ByteBuffer(Byte[], Int32, Int32, Int32)

Initializes a new buffer from a byte array.

Declaration
public ByteBuffer(byte[] buffer, int offset, int count, int capacity)
Parameters
Type Name Description
System.Byte[] buffer

The byte array.

System.Int32 offset

The start position.

System.Int32 count

The number of bytes.

System.Int32 capacity

The total size of the byte array from offset.

ByteBuffer(Int32, Boolean)

Initializes a new buffer of a specified size.

Declaration
public ByteBuffer(int size, bool autoGrow)
Parameters
Type Name Description
System.Int32 size

The size in bytes.

System.Boolean autoGrow

If the buffer should auto-grow when a write size is larger than the buffer size.

Properties

Buffer

Gets the byte array.

Declaration
public byte[] Buffer { get; }
Property Value
Type Description
System.Byte[]

Capacity

Gets the capacity.

Declaration
public int Capacity { get; }
Property Value
Type Description
System.Int32

Length

Gets the available size for read.

Declaration
public int Length { get; }
Property Value
Type Description
System.Int32

Offset

Gets the current offset (read position).

Declaration
public int Offset { get; }
Property Value
Type Description
System.Int32

Size

Gets the remaining size for write.

Declaration
public int Size { get; }
Property Value
Type Description
System.Int32

WritePos

Gets the write position.

Declaration
public int WritePos { get; }
Property Value
Type Description
System.Int32

Methods

AdjustPosition(Int32, Int32)

Adjusts the read and write position.

Declaration
public void AdjustPosition(int offset, int length)
Parameters
Type Name Description
System.Int32 offset

Read position to set.

System.Int32 length

Length from read position to set the write position.

Append(Int32)

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

Declaration
public void Append(int size)
Parameters
Type Name Description
System.Int32 size

Size to advance.

Complete(Int32)

Advances the read position.

Declaration
public void Complete(int size)
Parameters
Type Name Description
System.Int32 size

Size to advance.

Reset()

Resets read and write position to the initial state.

Declaration
public void Reset()

Seek(Int32)

Sets the read position.

Declaration
public void Seek(int seekPosition)
Parameters
Type Name Description
System.Int32 seekPosition

Position to set.

Shrink(Int32)

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

Declaration
public void Shrink(int size)
Parameters
Type Name Description
System.Int32 size

Validate(Boolean, Int32)

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

Declaration
public void Validate(bool write, int dataSize)
Parameters
Type Name Description
System.Boolean write

Operation to verify. True for write and false for read.

System.Int32 dataSize

The size to read or write.

ValidateRead(Int32)

Verifies that the buffer has enough bytes for read.

Declaration
public void ValidateRead(int dataSize)
Parameters
Type Name Description
System.Int32 dataSize

The size to read.

ValidateWrite(Int32)

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

Declaration
public void ValidateWrite(int dataSize)
Parameters
Type Name Description
System.Int32 dataSize

The size to write.

Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX