Mutable byte class allows for manipulation of a byte array with
operations like append, prepend.
Functionality is implemented through temporary buffer creation
and data duplication.
CopyC#
Namespace:
SnmpSharpNetMutableByte buffer = new MutableByte(); buffer += "test data"; buffer.Append(". More test data"); buffer.Prepend("This is "); Console.WriteLine(buffer.ToString()); // Prints out "This is test data. More test data" buffer.RemoveBeginning(8); // The buffer now holds "test data. More test data" buffer.Prepend("It could be "); // buffer is "It could be test data. More test data" buffer.RemoveEnd(" More test data".Length); // buffer: "It could be test data." buffer.Remove(12,5); // buffer: "It could be data" Console.WriteLine("{0}",Convert.ToChar(buffer[1])); // Output: "t" byte[] tmpBuffer = buffer; // Implicit conversion to byte[] buffer.Reset(); // Erase all the data from the buffer
Assembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.5.0.0 (0.5.0.0)
Syntax
| C# | Visual Basic | Visual C++ |
public class MutableByte : ICloneable, IComparable<MutableByte>, IComparable<byte[]>
Public Class MutableByte _ Implements ICloneable, IComparable(Of MutableByte), _ IComparable(Of Byte())
public ref class MutableByte : ICloneable, IComparable<MutableByte^>, IComparable<array<unsigned char>^>
Members
| All Members | Constructors | Properties | Methods |
| Member | Description | |
|---|---|---|
| MutableByte()()() |
Standard constructor. Initializes the internal buffer to null.
| |
| MutableByte(array<Byte>[]()[]) |
Constructor. Initialize internal buffer with supplied value.
| |
| MutableByte(array<Byte>[]()[], array<Byte>[]()[]) |
Create new MutableByte class initialized by adding two byte buffers together. If
one of the supplied byte arrays is value null then ArgumentNullException is thrown.
| |
| MutableByte(array<Byte>[]()[], Int32) |
Create new MutableByte class initialized with data from the supplied array up to length of buflen. Internaly,
a call is made to MutableByte.Set(buf[],int) to initialize the new class data buffer.
| |
| Addition(MutableByte, MutableByte) |
Add MutableByte buffer values.
| |
| Addition(MutableByte, Byte) |
Add a MutableByte array and a single byte value
| |
| Addition(MutableByte, array<Byte>[]()[]) |
Add MutableByte and byte array values into a new MutableByte class.
| |
| Append(Byte) |
Append a single byte value to the internal buffer
| |
| Append(array<Byte>[]()[]) |
Append data to the internal buffer
| |
| Clone()()() |
Clone object
| |
| CompareTo(MutableByte) |
Compare class to another MutableByte class.
| |
| CompareTo(array<Byte>[]()[]) |
Compare class to a byte[] array.
| |
| Equality(MutableByte, MutableByte) |
Compare two MutableByte class contents
| |
| Equals(Object) |
Compares MutableByte object against another MutableByte object or a byte array
(Overrides Object..::.Equals(Object).) | |
| Equals(array<Byte>[]()[], array<Byte>[]()[]) |
Compare two byte arrays
| |
| Get(Int32, Int32) |
Get sub-array
| |
| GetHashCode()()() |
Returns object hash code. Just calls the base class implementation.
(Overrides Object..::.GetHashCode()()().) | |
| GetType()()() |
Gets the Type of the current instance.
(Inherited from Object.) | |
| GreaterThan(MutableByte, MutableByte) |
Greater then operator overload.
| |
| Implicit(MutableByte) |
Allow implicit casting of this object as a byte array for any callers.
| |
| Inequality(MutableByte, MutableByte) |
Negative compare.
| |
| Insert(Int32, Byte) |
Insert single byte at specified location
| |
| Insert(Int32, array<Byte>[]()[]) |
Insert byte array at position
| |
| Item[([(Int32])]) |
Index operator. Index access to the underlying byte array
| |
| Length |
Byte buffer current length
| |
| LessThan(MutableByte, MutableByte) |
Lesser then operator overload.
| |
| Prepend(Byte) |
Prepend (add at the beginning) a single byte value
| |
| Prepend(array<Byte>[]()[]) |
Prepend (insert at beginning) a byte array
| |
| Remove(Int32, Int32) |
Remove array byte members starting with position start for the length length bytes.
| |
| RemoveBeginning(Int32) |
Remove bytes from the beginning of the array
| |
| RemoveEnd(Int32) |
Remove number of byte values from the end of the internal buffer
| |
| Reset()()() |
Reset object data to null
| |
| Set(Byte) |
Set internal buffer to size 1 and copy supplied byte value into it
| |
| Set(array<Byte>[]()[]) |
Set internal buffer to supplied value. Overwrites existing data.
| |
| Set(String) |
Set class value with bytes from the string. UTF8 encoding is assumed.
| |
| Set(array<Byte>[]()[], Int32) |
Copy source buffer array up to length into the class.
| |
| Set(Int32, Byte) |
Set value at specified position to the supplied value
| |
| Set(array<Byte>[]()[], Int32, Int32) |
Set class value to the contents of the supplied array starting from offset with specified length
| |
| ToString()()() |
Convert array to a string
(Overrides Object..::.ToString()()().) | |
| ToString(Int32, Int32) |
Hexadecimal data dump of the specific range of buffer values
|