Class VersatileBufferExtensions
Provides extension methods for VersatileBuffer.
public static class VersatileBufferExtensions
- Inheritance
-
VersatileBufferExtensions
- Inherited Members
Methods
Append(VersatileBuffer, string)
Appends a UTF-8 encoded string to the buffer.
public static void Append(this VersatileBuffer vb, string s)
Parameters
vbVersatileBufferThe buffer to append to.
sstringThe string to append.
ComputeHash(VersatileBuffer, HashAlgorithm, int, int)
Computes a hash of a portion of the buffer using the specified hash algorithm.
public static byte[] ComputeHash(this VersatileBuffer vb, HashAlgorithm hasher, int offset, int size)
Parameters
vbVersatileBufferThe buffer to compute the hash from.
hasherHashAlgorithmThe hash algorithm to use.
offsetintThe starting position within the buffer.
sizeintThe number of bytes to include in the hash computation.
Returns
- byte[]
A byte array containing the computed hash.
ConvertToBase64String(VersatileBuffer, int, int)
Converts a portion of the buffer to a Base64 encoded string.
public static string ConvertToBase64String(this VersatileBuffer vb, int offset, int size)
Parameters
vbVersatileBufferThe buffer to convert from.
offsetintThe starting position within the buffer.
sizeintThe number of bytes to convert.
Returns
- string
A Base64 encoded string representing the specified portion of the buffer.
Exceptions
- ArgumentException
Thrown when the offset and size exceed the buffer size.
ConvertToString(VersatileBuffer, int, int)
Converts a portion of the buffer to a UTF-8 encoded string.
public static string ConvertToString(this VersatileBuffer vb, int offset, int size)
Parameters
vbVersatileBufferThe buffer to convert from.
offsetintThe starting position within the buffer.
sizeintThe number of bytes to convert.
Returns
- string
A string decoded from the specified portion of the buffer using UTF-8 encoding.
Exceptions
- ArgumentException
Thrown when the offset and size exceed the buffer size.
Decrypt(VersatileBuffer, IEncrypter, int, int, ref byte[], VersatileBuffer)
Decrypts a portion of the buffer using the specified encrypter.
public static void Decrypt(this VersatileBuffer vb, IEncrypter crypto, int offset, int size, ref byte[] intermediateBuffer, VersatileBuffer decryptedPacket)
Parameters
vbVersatileBufferThe buffer containing encrypted data.
cryptoIEncrypterThe encrypter to use for decryption.
offsetintThe starting position of the encrypted data within the buffer.
sizeintThe number of bytes to decrypt.
intermediateBufferbyte[]A reusable intermediate buffer for copying data; will be allocated or resized as needed.
decryptedPacketVersatileBufferThe buffer to write the decrypted data to.
Encrypt(VersatileBuffer, IEncrypter, int, int, ref byte[], VersatileBuffer)
Encrypts a portion of the buffer using the specified encrypter.
public static void Encrypt(this VersatileBuffer vb, IEncrypter crypto, int offset, int size, ref byte[] intermediateBuffer, VersatileBuffer encryptedPacket)
Parameters
vbVersatileBufferThe buffer containing data to encrypt.
cryptoIEncrypterThe encrypter to use for encryption.
offsetintThe starting position of the data within the buffer.
sizeintThe number of bytes to encrypt.
intermediateBufferbyte[]A reusable intermediate buffer for copying data; will be allocated or resized as needed.
encryptedPacketVersatileBufferThe buffer to write the encrypted data to.