Implementation of the IMemoryBuffer interface, providing methods to manage a byte buffer.
More...
|
| MemoryBuffer () |
| Initializes a new instance of the MemoryBuffer class.
|
|
| MemoryBuffer (int capacity) |
| Initializes a new instance of the MemoryBuffer class with the specified capacity.
|
|
| MemoryBuffer (byte[] buffer) |
| Initializes a new instance of the MemoryBuffer class with the specified byte array.
|
|
bool | IsEmpty () |
| Checks if the buffer is empty.
|
|
byte[] | ToArray () |
| Converts the entire buffer to a byte array.
|
|
byte[] | ToArray (int position, int length) |
| Converts a portion of the buffer to a byte array.
|
|
void | Clear () |
| Clears the buffer.
|
|
string | ExtractString (int position, int length) |
| Extracts a string from the buffer.
|
|
void | Remove (int position, int length) |
| Removes a portion of the buffer.
|
|
void | Reserve (int capacity) |
| Reserves additional capacity for the buffer.
|
|
void | Resize (int length) |
| Resizes the buffer to the specified length.
|
|
void | Shift (int positionAmount) |
| Shifts the current position in the buffer by the specified amount.
|
|
int | Write (byte value) |
| Writes a byte to the buffer.
|
|
int | Write (string text) |
| Writes a string to the buffer.
|
|
int | Write (byte[] buffer) |
| Writes a byte array to the buffer.
|
|
int | Write (byte[] buffer, int position, int length) |
| Writes a portion of a byte array to the buffer.
|
|
|
int | Capacity [get] |
| Gets the capacity of the current buffer.
|
|
byte[] | Buffer [get] |
| Gets the current buffer as a byte array.
|
|
int | Length [get] |
| Gets the current length of the buffer.
|
|
int | Position [get] |
| Gets the current position in the buffer.
|
|
byte | this[int index] [get] |
| Gets the byte at the specified index in the buffer.
|
|
Implementation of the IMemoryBuffer interface, providing methods to manage a byte buffer.
◆ MemoryBuffer() [1/2]
XmobiTea.ProtonNetCommon.MemoryBuffer.MemoryBuffer |
( |
int | capacity | ) |
|
Initializes a new instance of the MemoryBuffer class with the specified capacity.
- Parameters
-
capacity | The initial capacity of the buffer. |
◆ MemoryBuffer() [2/2]
XmobiTea.ProtonNetCommon.MemoryBuffer.MemoryBuffer |
( |
byte[] | buffer | ) |
|
Initializes a new instance of the MemoryBuffer class with the specified byte array.
- Parameters
-
buffer | The initial byte array. |
◆ Clear()
void XmobiTea.ProtonNetCommon.MemoryBuffer.Clear |
( |
| ) |
|
◆ ExtractString()
string XmobiTea.ProtonNetCommon.MemoryBuffer.ExtractString |
( |
int | position, |
|
|
int | length ) |
Extracts a string from the buffer.
- Parameters
-
position | The starting position in the buffer. |
length | The length of the string to extract. |
- Returns
- The extracted string.
- Exceptions
-
ArgumentException | Thrown when the position and length are invalid. |
Implements XmobiTea.ProtonNetCommon.IMemoryBuffer.
◆ IsEmpty()
bool XmobiTea.ProtonNetCommon.MemoryBuffer.IsEmpty |
( |
| ) |
|
◆ Remove()
void XmobiTea.ProtonNetCommon.MemoryBuffer.Remove |
( |
int | position, |
|
|
int | length ) |
Removes a portion of the buffer.
- Parameters
-
position | The starting position in the buffer. |
length | The length of the portion to remove. |
- Exceptions
-
ArgumentException | Thrown when the position and length are invalid. |
Implements XmobiTea.ProtonNetCommon.IMemoryBuffer.
◆ Reserve()
void XmobiTea.ProtonNetCommon.MemoryBuffer.Reserve |
( |
int | capacity | ) |
|
Reserves additional capacity for the buffer.
- Parameters
-
capacity | The new capacity to reserve. |
- Exceptions
-
ArgumentException | Thrown when the capacity is less than 0. |
Implements XmobiTea.ProtonNetCommon.IMemoryBuffer.
◆ Resize()
void XmobiTea.ProtonNetCommon.MemoryBuffer.Resize |
( |
int | length | ) |
|
◆ Shift()
void XmobiTea.ProtonNetCommon.MemoryBuffer.Shift |
( |
int | positionAmount | ) |
|
◆ ToArray() [1/2]
byte[] XmobiTea.ProtonNetCommon.MemoryBuffer.ToArray |
( |
| ) |
|
◆ ToArray() [2/2]
byte[] XmobiTea.ProtonNetCommon.MemoryBuffer.ToArray |
( |
int | position, |
|
|
int | length ) |
Converts a portion of the buffer to a byte array.
- Parameters
-
position | The starting position in the buffer. |
length | The length of the portion to convert. |
- Returns
- A new byte array containing the specified portion of the buffer.
Implements XmobiTea.ProtonNetCommon.IMemoryBuffer.
◆ Write() [1/4]
int XmobiTea.ProtonNetCommon.MemoryBuffer.Write |
( |
byte | value | ) |
|
◆ Write() [2/4]
int XmobiTea.ProtonNetCommon.MemoryBuffer.Write |
( |
byte[] | buffer | ) |
|
◆ Write() [3/4]
int XmobiTea.ProtonNetCommon.MemoryBuffer.Write |
( |
byte[] | buffer, |
|
|
int | position, |
|
|
int | length ) |
Writes a portion of a byte array to the buffer.
- Parameters
-
buffer | The byte array to write from. |
position | The starting position in the byte array. |
length | The number of bytes to write. |
- Returns
- The number of bytes written.
Implements XmobiTea.ProtonNetCommon.IMemoryBuffer.
◆ Write() [4/4]
int XmobiTea.ProtonNetCommon.MemoryBuffer.Write |
( |
string | text | ) |
|
◆ Buffer
byte [] XmobiTea.ProtonNetCommon.MemoryBuffer.Buffer |
|
get |
◆ Capacity
int XmobiTea.ProtonNetCommon.MemoryBuffer.Capacity |
|
get |
◆ Length
int XmobiTea.ProtonNetCommon.MemoryBuffer.Length |
|
get |
◆ Position
int XmobiTea.ProtonNetCommon.MemoryBuffer.Position |
|
get |
◆ this[int index]
byte XmobiTea.ProtonNetCommon.MemoryBuffer.this[int index] |
|
get |
The documentation for this class was generated from the following file:
- XmobiTea.ProtonNetCommon/IMemoryBuffer.cs