Instance Methodmigueldeicaza.swiftgodot 0.45.0SwiftGodot
get16
Gets a signed 16-bit value from the stream.
StreamPeer.swift:708final func get16() -> Int16
Other members in extension
Type members
Instance members
var bigEndian: Bool
If
true
, thisStreamPeer
will using big-endian format for encoding and decoding.func get32(
) -> Int32 Gets a signed 32-bit value from the stream.
func get64(
) -> Int Gets a signed 64-bit value from the stream.
func get8(
) -> Int8 Gets a signed byte from the stream.
func getAvailableBytes(
) -> Int32 Returns the number of bytes this
StreamPeer
has available.func getData(bytes: Int32
) -> GArray Returns a chunk data with the received bytes. The number 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, anGodotError
code and a data array.func getDouble(
) -> Double Gets a double-precision float from the stream.
func getFloat(
) -> Double Gets a single-precision float from the stream.
func getPartialData(bytes: Int32
) -> GArray Returns a chunk data with the received bytes. The number 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
GodotError
code, and a data array.func getString(bytes: Int32
) -> String Gets an ASCII string with byte-length
bytes
from the stream. Ifbytes
is negative (default) the length will be read from the stream using the reverse process ofputString(value:)
.func getU16(
) -> UInt16 Gets an unsigned 16-bit value from the stream.
func getU32(
) -> UInt32 Gets an unsigned 32-bit value from the stream.
func getU64(
) -> UInt Gets an unsigned 64-bit value from the stream.
func getU8(
) -> UInt8 Gets an unsigned byte from the stream.
func getUtf8String(bytes: Int32
) -> String Gets a UTF-8 string with byte-length
bytes
from the stream (this decodes the string sent as UTF-8). Ifbytes
is negative (default) the length will be read from the stream using the reverse process ofputUtf8String(value:)
.func getVar(allowObjects: Bool
) -> Variant Gets a Variant from the stream. If
allowObjects
istrue
, decoding objects is allowed.func put16(value: Int16
) Puts a signed 16-bit value into the stream.
func put32(value: Int32
) Puts a signed 32-bit value into the stream.
func put64(value: Int
) Puts a signed 64-bit value into the stream.
func put8(value: Int8
) Puts a signed byte into the stream.
func putData(PackedByteArray
) -> GodotError Sends a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an
GodotError
code.func putDouble(value: Double
) Puts a double-precision float into the stream.
func putFloat(value: Double
) Puts a single-precision float into the stream.
func putPartialData(PackedByteArray
) -> GArray 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
GodotError
code and an integer, describing how much data was actually sent.func putString(value: String
) Puts a zero-terminated ASCII string into the stream prepended by a 32-bit unsigned integer representing its size.
func putU16(value: UInt16
) Puts an unsigned 16-bit value into the stream.
func putU32(value: UInt32
) Puts an unsigned 32-bit value into the stream.
func putU64(value: UInt
) Puts an unsigned 64-bit value into the stream.
func putU8(value: UInt8
) Puts an unsigned byte into the stream.
func putUtf8String(value: String
) Puts a zero-terminated UTF-8 string into the stream prepended by a 32 bits unsigned integer representing its size.
func putVar(value: Variant, fullObjects: Bool
) Puts a Variant into the stream. If
fullObjects
istrue
encoding objects is allowed (and can potentially include code).