Class ReadMinecraftBufferExtensions
Namespace: Void.Minecraft.Buffers.Extensions
Assembly: Void.Minecraft.dll
public static class ReadMinecraftBufferExtensionsInheritance
object ← ReadMinecraftBufferExtensions
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
Dump<TBuffer>(ref TBuffer)
Debug only. Returns a read-only span of bytes from the specified buffer starting at index 0 up to its length.
public static ReadOnlySpan<byte> Dump<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to a buffer from which the byte span is accessed.
Returns
The method returns a read-only span of bytes representing the contents of the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface.
Read<TBuffer>(ref TBuffer, int)
Reads a specified number of bytes from a buffer and returns them as a read-only span.
public static ReadOnlySpan<byte> Read<TBuffer>(this ref TBuffer buffer, int length) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The buffer from which bytes are read and manipulated.
length int
The number of bytes to read from the buffer.
Returns
A read-only span containing the bytes that were read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface.
ReadBoolean<TBuffer>(ref TBuffer)
Reads a boolean value from the provided buffer.
public static bool ReadBoolean<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which the boolean value is read.
Returns
Returns the boolean value read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadByteArray<TBuffer>(ref TBuffer)
public static ReadOnlySpan<byte> ReadByteArray<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
Returns
Type Parameters
TBuffer
ReadComponent<TBuffer>(ref TBuffer)
Reads a component from a specified buffer using a given protocol version.
public static Component ReadComponent<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is the data source from which the component is read.
Returns
Returns the component that has been read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadDouble<TBuffer>(ref TBuffer)
Reads an 8-byte double value from a buffer in big-endian format.
public static double ReadDouble<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter provides access to the data from which the double value is read.
Returns
The method returns the double value read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadFloat<TBuffer>(ref TBuffer)
Reads a 4-byte floating-point value from a buffer in big-endian format.
public static float ReadFloat<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which the floating-point value is read.
Returns
The method returns the floating-point value read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface.
ReadInt<TBuffer>(ref TBuffer)
Reads a 32-bit integer from a buffer in big-endian format.
public static int ReadInt<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The buffer from which the integer is read, passed by reference.
Returns
The 32-bit integer read from the buffer.
Type Parameters
TBuffer
The type used for the buffer must be a struct that implements a specific interface.
ReadIntArray<TBuffer>(ref TBuffer)
Reads a sequence of 32-bit integers from the specified Minecraft buffer.
public static ReadOnlyMemory<int> ReadIntArray<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
A reference to the buffer from which the integer array is read. The buffer must be a valid instance of a type that implements IMinecraftBuffer.
Returns
A read-only span containing the integers read from the buffer.
Type Parameters
TBuffer
The type of the buffer that implements the IMinecraftBuffer interface.
Remarks
This method is an extension for types implementing IMinecraftBuffer, enabling efficient reading of integer arrays without additional allocations. The returned span is only valid as long as the underlying buffer remains unchanged.
ReadLong<TBuffer>(ref TBuffer)
Reads a 64-bit integer from a buffer in big-endian format.
public static long ReadLong<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter provides access to the data from which the integer is read.
Returns
Returns the 64-bit integer read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadProperty<TBuffer>(ref TBuffer)
Reads a property from a buffer and returns it.
public static Property ReadProperty<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter is a reference to the buffer from which the property is read.
Returns
The method returns the property read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadPropertyArray<TBuffer>(ref TBuffer, int)
Reads an array of properties from a buffer, allowing for a specified number of properties to be read.
public static ReadOnlyMemory<Property> ReadPropertyArray<TBuffer>(this ref TBuffer buffer, int count = -1) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The buffer from which properties are read, passed by reference to allow modifications.
count int
Specifies the number of properties to read from the buffer, with a default value indicating all properties should be read.
Returns
An array of properties read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadShort<TBuffer>(ref TBuffer)
Reads a 16-bit short value from a buffer in big-endian format.
public static short ReadShort<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter provides access to the data from which the short value is read.
Returns
Returns the 16-bit short value read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadString<TBuffer>(ref TBuffer, int)
Reads a string from a buffer with a specified maximum length.
public static string ReadString<TBuffer>(this ref TBuffer buffer, int maxLength = 32767) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which the string is read.
maxLength int
This parameter defines the maximum number of characters to read from the buffer.
Returns
The method returns the string read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface.
ReadTag<TBuffer>(ref TBuffer, bool)
Reads a tag from a buffer and returns it as an NbtTag object.
public static NbtTag ReadTag<TBuffer>(this ref TBuffer buffer, bool readName = true) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which the tag is read.
readName bool
Returns
Returns an NbtTag object that represents the read tag.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadToEnd<TBuffer>(ref TBuffer)
Reads all remaining data from a buffer and returns it as a read-only span of bytes.
public static ReadOnlySpan<byte> ReadToEnd<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which data will be read.
Returns
A read-only span containing the bytes read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface.
ReadUnsignedByte<TBuffer>(ref TBuffer)
Reads a single byte from the provided buffer.
public static byte ReadUnsignedByte<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter is a reference to a buffer from which a byte will be read.
Returns
Returns the byte read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadUnsignedShort<TBuffer>(ref TBuffer)
Reads a 16-bit unsigned integer from a buffer in big-endian format.
public static ushort ReadUnsignedShort<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter provides access to the data from which the unsigned short is read.
Returns
Returns the 16-bit unsigned integer read from the buffer.
Type Parameters
TBuffer
The type parameter represents a structure that implements a specific buffer interface.
ReadUuid<TBuffer>(ref TBuffer)
Reads a UUID from a buffer by extracting two long values.
public static Uuid ReadUuid<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
This parameter is a reference to the buffer from which the UUID is read.
Returns
Returns a UUID constructed from the two long values read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadUuidAsIntArray<TBuffer>(ref TBuffer)
Reads a UUID from a buffer and returns it as an integer array.
public static Uuid ReadUuidAsIntArray<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The buffer is used to read the UUID data from its current position.
Returns
An integer array representing the UUID.
Type Parameters
TBuffer
This type is a struct that implements a specific buffer interface for reading data.
ReadVarInt<TBuffer>(ref TBuffer)
Reads a variable-length integer from a buffer.
public static int ReadVarInt<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter is a reference to the buffer from which the variable-length integer is read.
Returns
Returns the integer value read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadVarIntArray<TBuffer>(ref TBuffer)
public static ReadOnlyMemory<int> ReadVarIntArray<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
Returns
Type Parameters
TBuffer
ReadVarLong<TBuffer>(ref TBuffer)
Reads a variable-length long value from a buffer.
public static long ReadVarLong<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The parameter is a reference to the buffer from which the long value is read.
Returns
Returns the long value read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.
ReadVarShort<TBuffer>(ref TBuffer)
Reads a variable-length short value from a buffer.
public static int ReadVarShort<TBuffer>(this ref TBuffer buffer) where TBuffer : struct, IMinecraftBuffer<TBuffer>, allows ref structParameters
buffer TBuffer
The reference to the buffer from which the variable-length short value is read.
Returns
Returns the short value read from the buffer.
Type Parameters
TBuffer
This type parameter represents a structure that implements a specific buffer interface for reading data.