StreamPeer

Abstraction and base class for stream-based protocols.

StreamPeer is an abstraction and base class for stream-based protocols (such as TCP). It provides an API for sending and receiving data through streams as raw data or strings.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

get16
long get16()

Gets a signed 16-bit value from the stream.

get32
long get32()

Gets a signed 32-bit value from the stream.

get64
long get64()

Gets a signed 64-bit value from the stream.

get8
long get8()

Gets a signed byte from the stream.

getAvailableBytes
long getAvailableBytes()

Returns the amount of bytes this StreamPeer has available.

getData
Array getData(long bytes)

Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the bytes argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an @GlobalScope.error code and a data array.

getDouble
double getDouble()

Gets a double-precision float from the stream.

getFloat
double getFloat()

Gets a single-precision float from the stream.

getPartialData
Array getPartialData(long bytes)

Returns a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an @GlobalScope.error code, and a data array.

getString
String getString(long bytes)

Gets a string with byte-length bytes from the stream. If bytes is negative (default) the length will be read from the stream using the reverse process of putString.

getU16
long getU16()

Gets an unsigned 16-bit value from the stream.

getU32
long getU32()

Gets an unsigned 32-bit value from the stream.

getU64
long getU64()

Gets an unsigned 64-bit value from the stream.

getU8
long getU8()

Gets an unsigned byte from the stream.

getUtf8String
String getUtf8String(long bytes)

Gets an UTF-8 string with byte-length bytes from the stream (this decodes the string sent as UTF-8). If bytes is negative (default) the length will be read from the stream using the reverse process of putUtf8String.

getVar
Variant getVar(bool allow_objects)

Gets a Variant from the stream. If allow_objects is true, decoding objects is allowed. Warning: Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.

isBigEndianEnabled
bool isBigEndianEnabled()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(StreamPeer other)
opEquals
bool opEquals(typeof(null) n)
put16
void put16(long value)

Puts a signed 16-bit value into the stream.

put32
void put32(long value)

Puts a signed 32-bit value into the stream.

put64
void put64(long value)

Puts a signed 64-bit value into the stream.

put8
void put8(long value)

Puts a signed byte into the stream.

putData
GodotError putData(PoolByteArray data)

Sends a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an @GlobalScope.error code.

putDouble
void putDouble(double value)

Puts a double-precision float into the stream.

putFloat
void putFloat(double value)

Puts a single-precision float into the stream.

putPartialData
Array putPartialData(PoolByteArray data)

Sends a chunk of data through the connection. If all the data could not be sent at once, only part of it will. This function returns two values, an @GlobalScope.error code and an integer, describing how much data was actually sent.

putString
void putString(String value)

Puts a zero-terminated ASCII string into the stream prepended by a 32-bit unsigned integer representing its size. Note: To put an ASCII string without prepending its size, you can use putData:

putU16
void putU16(long value)

Puts an unsigned 16-bit value into the stream.

putU32
void putU32(long value)

Puts an unsigned 32-bit value into the stream.

putU64
void putU64(long value)

Puts an unsigned 64-bit value into the stream.

putU8
void putU8(long value)

Puts an unsigned byte into the stream.

putUtf8String
void putUtf8String(String value)

Puts a zero-terminated UTF-8 string into the stream prepended by a 32 bits unsigned integer representing its size. Note: To put an UTF-8 string without prepending its size, you can use putData:

putVar
void putVar(VariantArg0 value, bool full_objects)

Puts a Variant into the stream. If full_objects is true encoding objects is allowed (and can potentially include code).

setBigEndian
void setBigEndian(bool enable)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

bigEndian
bool bigEndian [@property getter]
bool bigEndian [@property setter]

If true, this StreamPeer will using big-endian format for encoding and decoding.

Static functions

_new
StreamPeer _new()

Construct a new instance of StreamPeer. Note: use memnew!StreamPeer instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta