Class Lidgren::Network::NetBuffer
ClassList > Lidgren > Network > NetBuffer
Base class for NetIncomingMessage and NetOutgoingMessage.
Inherited by the following classes: Lidgren::Network::NetIncomingMessage, Lidgren::Network::NetOutgoingMessage
Public Properties
| Type | Name |
|---|---|
| property byte[] | Data Gets or sets the internal data buffer. |
| property int | LengthBits Gets or sets the length of the used portion of the buffer in bits. |
| property int | LengthBytes Gets or sets the length of the used portion of the buffer in bytes. |
| property long | Position Gets or sets the read position in the buffer, in bits (not bytes) |
| property int | PositionInBytes Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure. |
Public Functions
| Type | Name |
|---|---|
| void | EnsureBufferSize (int numberOfBits) Ensures the buffer can hold this number of bits. |
| bool | PeekBoolean () Reads a 1-bit Boolean without advancing the read pointer. |
| byte | PeekByte () Reads a Byte without advancing the read pointer. |
| byte | PeekByte (int numberOfBits) Reads the specified number of bits into a Byte without advancing the read pointer. |
| byte[] | PeekBytes (int numberOfBytes) Reads the specified number of bytes without advancing the read pointer. |
| void | PeekBytes (byte[] into, int offset, int numberOfBytes) Reads the specified number of bytes without advancing the read pointer. |
| byte[] | PeekDataBuffer () Gets the internal data buffer. |
| double | PeekDouble () Reads a 64-bit Double without advancing the read pointer. |
| float | PeekFloat () Reads a 32-bit Single without advancing the read pointer. |
| Int16 | PeekInt16 () Reads an Int16 without advancing the read pointer. |
| Int32 | PeekInt32 () Reads an Int32 without advancing the read pointer. |
| Int32 | PeekInt32 (int numberOfBits) Reads the specified number of bits into an Int32 without advancing the read pointer. |
| Int64 | PeekInt64 () Reads an Int64 without advancing the read pointer. |
| Int64 | PeekInt64 (int numberOfBits) Reads the specified number of bits into an Int64 without advancing the read pointer. |
| sbyte | PeekSByte () Reads an SByte without advancing the read pointer. |
| float | PeekSingle () Reads a 32-bit Single without advancing the read pointer. |
| string | PeekString () Reads a string without advancing the read pointer. |
| UInt16 | PeekUInt16 () Reads a UInt16 without advancing the read pointer. |
| UInt32 | PeekUInt32 () Reads a UInt32 without advancing the read pointer. |
| UInt32 | PeekUInt32 (int numberOfBits) Reads the specified number of bits into a UInt32 without advancing the read pointer. |
| UInt64 | PeekUInt64 () Reads a UInt64 without advancing the read pointer. |
| UInt64 | PeekUInt64 (int numberOfBits) Reads the specified number of bits into an UInt64 without advancing the read pointer. |
| void | ReadAllFields (object target) Reads all public and private declared instance fields of the object in alphabetical order using reflection. |
| void | ReadAllFields (object target, BindingFlags flags) Reads all fields with the specified binding of the object in alphabetical order using reflection. |
| void | ReadAllProperties (object target) Reads all public and private declared instance fields of the object in alphabetical order using reflection. |
| void | ReadAllProperties (object target, BindingFlags flags) Reads all fields with the specified binding of the object in alphabetical order using reflection. |
| void | ReadBits (byte[] into, int offset, int numberOfBits) Reads the specified number of bits into a preallocated array. |
| bool | ReadBoolean () Reads a boolean value (stored as a single bit) written using Write(bool) |
| byte | ReadByte () Reads a byte. |
| bool | ReadByte (out byte result) Reads a byte and returns true or false for success. |
| byte | ReadByte (int numberOfBits) Reads 1 to 8 bits into a byte. |
| byte[] | ReadBytes (int numberOfBytes) Reads the specified number of bytes. |
| bool | ReadBytes (int numberOfBytes, out byte[] result) Reads the specified number of bytes and returns true for success. |
| void | ReadBytes (byte[] into, int offset, int numberOfBytes) Reads the specified number of bytes into a preallocated array. |
| double | ReadDouble () Reads a 64 bit floating point value written using Write(Double) |
| float | ReadFloat () Reads a 32 bit floating point value written using Write(Single) |
| NetEndPoint | ReadIPEndPoint () Reads a stored IPv4 endpoint description. |
| Int16 | ReadInt16 () Reads a 16 bit signed integer written using Write(Int16) |
| Int32 | ReadInt32 () Reads a 32 bit signed integer written using Write(Int32) |
| bool | ReadInt32 (out Int32 result) Reads a 32 bit signed integer written using Write(Int32) |
| Int32 | ReadInt32 (int numberOfBits) Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32) |
| Int64 | ReadInt64 () Reads a 64 bit signed integer written using Write(Int64) |
| Int64 | ReadInt64 (int numberOfBits) Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32) |
| Matrix4x4 | ReadMatrix4X4 () |
| void | ReadPadBits () Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. |
| Plane | ReadPlane () |
| Quaternion | ReadQuaternion () |
| int | ReadRangedInteger (int min, int max) Reads a 32 bit integer value written using WriteRangedInteger() |
| long | ReadRangedInteger (long min, long max) Reads a 64 bit integer value written using WriteRangedInteger() (64 version) |
| float | ReadRangedSingle (float min, float max, int numberOfBits) Reads a 32 bit floating point value written using WriteRangedSingle() |
| Ray | ReadRay () |
| Rect | ReadRect () |
| Color32 | ReadRgbColor () |
| Color32 | ReadRgbaColor () |
| sbyte | ReadSByte () Reads a signed byte. |
| float | ReadSignedSingle (int numberOfBits) Reads a 32 bit floating point value written using WriteSignedSingle() |
| float | ReadSingle () Reads a 32 bit floating point value written using Write(Single) |
| bool | ReadSingle (out float result) Reads a 32 bit floating point value written using Write(Single) |
| string | ReadString () Reads a string written using Write(string) |
| bool | ReadString (out string result) Reads a string written using Write(string) and returns true for success. |
| double | ReadTime (NetConnection connection, bool highPrecision) Reads a value, in local time comparable to NetTime.Now, written using WriteTime() for the connection supplied. |
| UInt16 | ReadUInt16 () Reads a 16 bit unsigned integer written using Write(UInt16) |
| UInt32 | ReadUInt32 () Reads an 32 bit unsigned integer written using Write(UInt32) |
| bool | ReadUInt32 (out UInt32 result) Reads an 32 bit unsigned integer written using Write(UInt32) and returns true for success. |
| UInt32 | ReadUInt32 (int numberOfBits) Reads an unsigned integer stored in 1 to 32 bits, written using Write(UInt32, Int32) |
| UInt64 | ReadUInt64 () Reads a 64 bit unsigned integer written using Write(UInt64) |
| UInt64 | ReadUInt64 (int numberOfBits) Reads an unsigned integer stored in 1 to 64 bits, written using Write(UInt64, Int32) |
| float | ReadUnitSingle (int numberOfBits) Reads a 32 bit floating point value written using WriteUnitSingle() |
| int | ReadVariableInt32 () Reads a variable sized Int32 written using WriteVariableInt32() |
| Int64 | ReadVariableInt64 () Reads a variable sized Int64 written using WriteVariableInt64() |
| uint | ReadVariableUInt32 () Reads a variable sized UInt32 written using WriteVariableUInt32() |
| bool | ReadVariableUInt32 (out uint result) Reads a variable sized UInt32 written using WriteVariableUInt32() and returns true for success. |
| UInt64 | ReadVariableUInt64 () Reads a variable sized UInt32 written using WriteVariableInt64() |
| Vector2 | ReadVector2 () |
| Vector3 | ReadVector3 () |
| Vector4 | ReadVector4 () |
| void | SkipPadBits () Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. |
| void | SkipPadBits (int numberOfBits) Pads data with the specified number of bits. |
| void | Write (bool value) Writes a boolean value using 1 bit. |
| void | Write (byte source) Write a byte. |
| void | Write (sbyte source) Writes a signed byte. |
| void | Write (byte source, int numberOfBits) Writes 1 to 8 bits of a byte. |
| void | Write (byte[] source) Writes all bytes in an array. |
| void | Write (byte[] source, int offsetInBytes, int numberOfBytes) Writes the specified number of bytes from an array. |
| void | Write (UInt16 source) Writes an unsigned 16 bit integer. |
| void | Write (UInt16 source, int numberOfBits) Writes an unsigned integer using 1 to 16 bits. |
| void | Write (Int16 source) Writes a signed 16 bit integer. |
| void | Write (Int32 source) Writes a 32 bit signed integer. |
| void | Write (UInt32 source) Writes a 32 bit unsigned integer. |
| void | Write (UInt32 source, int numberOfBits) Writes a 32 bit signed integer. |
| void | Write (Int32 source, int numberOfBits) Writes a signed integer using 1 to 32 bits. |
| void | Write (UInt64 source) Writes a 64 bit unsigned integer. |
| void | Write (UInt64 source, int numberOfBits) Writes an unsigned integer using 1 to 64 bits. |
| void | Write (Int64 source) Writes a 64 bit signed integer. |
| void | Write (Int64 source, int numberOfBits) Writes a signed integer using 1 to 64 bits. |
| void | Write (float source) Writes a 32 bit floating point value. |
| void | Write (double source) Writes a 64 bit floating point value. |
| void | Write (string source) Write a string. |
| void | Write (IPEndPoint endPoint) Writes an endpoint description. |
| void | Write (NetBuffer buffer) Append all the bits of message to this message. |
| void | Write (Vector2 vector) |
| void | Write (Vector3 vector) |
| void | Write (Vector4 vector) |
| void | Write (Quaternion quaternion) |
| void | Write (Ray ray) |
| void | Write (Plane plane) |
| void | Write (Matrix4x4 matrix) |
| void | Write (Rect rect) |
| void | WriteAllFields (object ob) Writes all public and private declared instance fields of the object in alphabetical order using reflection. |
| void | WriteAllFields (object ob, BindingFlags flags) Writes all fields with specified binding in alphabetical order using reflection. |
| void | WriteAllProperties (object ob) Writes all public and private declared instance properties of the object in alphabetical order using reflection. |
| void | WriteAllProperties (object ob, BindingFlags flags) Writes all properties with specified binding in alphabetical order using reflection. |
| void | WriteAt (Int32 offset, byte source) Writes a byte at a given offset in the buffer. |
| void | WriteAt (Int32 offset, UInt16 source) Writes a 16 bit unsigned integer at a given offset in the buffer. |
| void | WriteAt (Int32 offset, Int16 source) Writes a 16 bit signed integer at a given offset in the buffer. |
| void | WriteAt (Int32 offset, Int32 source) Writes a 32 bit signed integer at a given offset in the buffer. |
| void | WriteAt (Int32 offset, UInt32 source) Writes a 32 bit unsigned integer at a given offset in the buffer. |
| void | WriteAt (Int32 offset, UInt64 source) Writes a 64 bit unsigned integer at a given offset in the buffer. |
| void | WritePadBits () Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes. |
| void | WritePadBits (int numberOfBits) Pads data with the specified number of bits. |
| int | WriteRangedInteger (int min, int max, int value) Writes an integer with the least amount of bits need for the specified range Returns number of bits written. |
| int | WriteRangedInteger (long min, long max, long value) Writes an integer with the least amount of bits need for the specified range Returns number of bits written. |
| void | WriteRangedSingle (float value, float min, float max, int numberOfBits) Compress a float within a specified range using a certain number of bits. |
| void | WriteRgbColor (Color32 color) |
| void | WriteRgbaColor (Color32 color) |
| void | WriteSignedSingle (float value, int numberOfBits) Compress (lossy) a float in the range -1..1 using numberOfBits bits. |
| void | WriteTime (bool highPrecision) Writes the current local time to a message; readable (and convertable to local time) by the remote host using ReadTime() |
| void | WriteTime (double localTime, bool highPrecision) Writes a local timestamp to a message; readable (and convertable to local time) by the remote host using ReadTime() |
| void | WriteUnitSingle (float value, int numberOfBits) Compress (lossy) a float in the range 0..1 using numberOfBits bits. |
| int | WriteVariableInt32 (int value) Write Base128 encoded variable sized signed integer of up to 32 bits. |
| int | WriteVariableInt64 (Int64 value) Write Base128 encoded variable sized signed integer of up to 64 bits. |
| int | WriteVariableUInt32 (uint value) Write Base128 encoded variable sized unsigned integer of up to 32 bits. |
| int | WriteVariableUInt64 (UInt64 value) Write Base128 encoded variable sized unsigned integer of up to 64 bits. |
Protected Static Attributes
| Type | Name |
|---|---|
| const int | c_overAllocateAmount = = 4 Number of bytes to overallocate for each message to avoid resizing. |
Public Properties Documentation
property Data
property LengthBits
property LengthBytes
property Position
property PositionInBytes
Public Functions Documentation
function EnsureBufferSize
function PeekBoolean
function PeekByte [1/2]
function PeekByte [2/2]
function PeekBytes [1/2]
function PeekBytes [2/2]
function PeekDataBuffer
function PeekDouble
function PeekFloat
function PeekInt16
function PeekInt32 [1/2]
function PeekInt32 [2/2]
function PeekInt64 [1/2]
function PeekInt64 [2/2]
function PeekSByte
function PeekSingle
function PeekString
function PeekUInt16
function PeekUInt32 [1/2]
function PeekUInt32 [2/2]
function PeekUInt64 [1/2]
function PeekUInt64 [2/2]
function ReadAllFields [1/2]
function ReadAllFields [2/2]
function ReadAllProperties [1/2]
function ReadAllProperties [2/2]
function ReadBits
Reads the specified number of bits into a preallocated array.
Parameters:
intoThe destination arrayoffsetThe offset where to start writing in the destination arraynumberOfBitsThe number of bits to read
function ReadBoolean
function ReadByte [1/3]
function ReadByte [2/3]
function ReadByte [3/3]
function ReadBytes [1/3]
function ReadBytes [2/3]
function ReadBytes [3/3]
Reads the specified number of bytes into a preallocated array.
Parameters:
intoThe destination arrayoffsetThe offset where to start writing in the destination arraynumberOfBytesThe number of bytes to read
function ReadDouble
function ReadFloat
function ReadIPEndPoint
function ReadInt16
function ReadInt32 [1/3]
function ReadInt32 [2/3]
function ReadInt32 [3/3]
function ReadInt64 [1/2]
function ReadInt64 [2/2]
function ReadMatrix4X4
function ReadPadBits
function ReadPlane
function ReadQuaternion
function ReadRangedInteger [1/2]
Reads a 32 bit integer value written using WriteRangedInteger()
Parameters:
minThe minimum value used when writing the valuemaxThe maximum value used when writing the value
Returns:
A signed integer value larger or equal to MIN and smaller or equal to MAX
function ReadRangedInteger [2/2]
Reads a 64 bit integer value written using WriteRangedInteger() (64 version)
Parameters:
minThe minimum value used when writing the valuemaxThe maximum value used when writing the value
Returns:
A signed integer value larger or equal to MIN and smaller or equal to MAX
function ReadRangedSingle
Reads a 32 bit floating point value written using WriteRangedSingle()
inline float Lidgren::Network::NetBuffer::ReadRangedSingle (
float min,
float max,
int numberOfBits
)
Parameters:
minThe minimum value used when writing the valuemaxThe maximum value used when writing the valuenumberOfBitsThe number of bits used when writing the value
Returns:
A floating point value larger or equal to MIN and smaller or equal to MAX
function ReadRay
function ReadRect
function ReadRgbColor
function ReadRgbaColor
function ReadSByte
function ReadSignedSingle
Reads a 32 bit floating point value written using WriteSignedSingle()
Parameters:
numberOfBitsThe number of bits used when writing the value
Returns:
A floating point value larger or equal to -1 and smaller or equal to 1
function ReadSingle [1/2]
function ReadSingle [2/2]
function ReadString [1/2]
function ReadString [2/2]
function ReadTime
inline double Lidgren::Network::NetBuffer::ReadTime (
NetConnection connection,
bool highPrecision
)
function ReadUInt16
function ReadUInt32 [1/3]
function ReadUInt32 [2/3]
function ReadUInt32 [3/3]
function ReadUInt64 [1/2]
function ReadUInt64 [2/2]
function ReadUnitSingle
Reads a 32 bit floating point value written using WriteUnitSingle()
Parameters:
numberOfBitsThe number of bits used when writing the value
Returns:
A floating point value larger or equal to 0 and smaller or equal to 1
function ReadVariableInt32
function ReadVariableInt64
function ReadVariableUInt32 [1/2]
function ReadVariableUInt32 [2/2]
function ReadVariableUInt64
function ReadVector2
function ReadVector3
function ReadVector4
function SkipPadBits [1/2]
function SkipPadBits [2/2]
function Write [1/30]
function Write [2/30]
function Write [3/30]
function Write [4/30]
function Write [5/30]
function Write [6/30]
inline void Lidgren::Network::NetBuffer::Write (
byte[] source,
int offsetInBytes,
int numberOfBytes
)
function Write [7/30]
Writes an unsigned 16 bit integer.
Parameters:
source
function Write [8/30]
function Write [9/30]
function Write [10/30]
function Write [11/30]
function Write [12/30]
function Write [13/30]
function Write [14/30]
function Write [15/30]
function Write [16/30]
function Write [17/30]
function Write [18/30]
function Write [19/30]
function Write [20/30]
function Write [21/30]
function Write [22/30]
function Write [23/30]
function Write [24/30]
function Write [25/30]
function Write [26/30]
function Write [27/30]
function Write [28/30]
function Write [29/30]
function Write [30/30]
function WriteAllFields [1/2]
function WriteAllFields [2/2]
function WriteAllProperties [1/2]
function WriteAllProperties [2/2]
function WriteAt [1/6]
function WriteAt [2/6]
function WriteAt [3/6]
function WriteAt [4/6]
function WriteAt [5/6]
function WriteAt [6/6]
function WritePadBits [1/2]
function WritePadBits [2/2]
function WriteRangedInteger [1/2]
function WriteRangedInteger [2/2]
function WriteRangedSingle
inline void Lidgren::Network::NetBuffer::WriteRangedSingle (
float value,
float min,
float max,
int numberOfBits
)
function WriteRgbColor
function WriteRgbaColor
function WriteSignedSingle
function WriteTime [1/2]
function WriteTime [2/2]
function WriteUnitSingle
function WriteVariableInt32
Write Base128 encoded variable sized signed integer of up to 32 bits.
Returns:
number of bytes written
function WriteVariableInt64
Write Base128 encoded variable sized signed integer of up to 64 bits.
Returns:
number of bytes written
function WriteVariableUInt32
Write Base128 encoded variable sized unsigned integer of up to 32 bits.
Returns:
number of bytes written
function WriteVariableUInt64
Write Base128 encoded variable sized unsigned integer of up to 64 bits.
Returns:
number of bytes written
Protected Static Attributes Documentation
variable c_overAllocateAmount
The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/Lidgren.Network/NetBuffer.cs