Interface IByteBuffer
Represents a byte buffer (backed by various means depending on the implementation).
public interface IByteBuffer : IDisposable
- Inherited Members
- Extension Methods
Properties
Capacity
Gets the capacity.
int Capacity { get; }
Property Value
- int
The capacity.
IsReadOnly
Gets a value indicating whether this instance is read only.
bool IsReadOnly { get; }
Property Value
- bool
true
if this instance is read only; otherwise,false
.
Length
Gets or sets the length.
int Length { get; set; }
Property Value
- int
The length.
Methods
AccessBackingBytes(int)
Access the backing bytes directly. The returned ArraySegment will point to the desired position and contain as many bytes as possible up to the next chunk boundary (if any). If the returned ArraySegment does not contain enough bytes for your needs you will have to call ReadBytes instead.
ArraySegment<byte> AccessBackingBytes(int position)
Parameters
position
intThe position.
Returns
- ArraySegment<byte>
An ArraySegment pointing directly to the backing bytes for the position.
Clear(int, int)
Clears the specified bytes.
void Clear(int position, int count)
Parameters
EnsureCapacity(int)
Ensure that the buffer has a minimum capacity. Depending on the buffer allocation strategy calling this method may result in a higher capacity than the minimum (but never lower).
void EnsureCapacity(int minimumCapacity)
Parameters
minimumCapacity
intThe minimum capacity.
GetByte(int)
Gets a byte.
byte GetByte(int position)
Parameters
position
intThe position.
Returns
- byte
A byte.
GetBytes(int, byte[], int, int)
Gets bytes.
void GetBytes(int position, byte[] destination, int offset, int count)
Parameters
position
intThe position.
destination
byte[]The destination.
offset
intThe destination offset.
count
intThe count.
GetSlice(int, int)
Gets a slice of this buffer.
IByteBuffer GetSlice(int position, int length)
Parameters
Returns
- IByteBuffer
A slice of this buffer.
MakeReadOnly()
Makes this buffer read only.
void MakeReadOnly()
SetByte(int, byte)
Sets a byte.
void SetByte(int position, byte value)
Parameters
SetBytes(int, byte[], int, int)
Sets bytes.
void SetBytes(int position, byte[] source, int offset, int count)