This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.Stream Class

This class cannot be instantiated. It is a base class for:

Stream class allows you to write data into a stream, that is into files (stored on the disk), blobs (stored in system memory) and sockets (to be sent over the network), as well as read data from a stream.

Stream Class

Enums

TYPE#

NameDescription
BLOB = 0A stream for blobs.
FILE = 1A stream for files.
SOCKET = 2A stream for sockets.
USER = 3A user stream inherited from StreamBase.
NUM_STREAMS = 4Number of stream types.

Properties

int ByteOrder#

The value indicating the endianness of the stream.
set
Sets the endianness of the stream.
set value - A value indicating the endianness of the stream: 0 value is for LSB (least significant), 1 is for MSB (most significant).

bool IsAvailable#

The status of the stream.

bool IsOpened#

The status of the stream.

int Type#

Return the type of the stream.

Members


bool IsError ( ) #

Returns the status of the stream.

Return value

1 if there is a read/write error; otherwise, 0.

string Gets ( ) #

Reads the stream data from the current position.

Return value

Stream data starting from the current position.

int Puts ( string str ) #

Writes a non-binary string of characters to the stream.

Arguments

  • string str - String to write.

Return value

1 if a string of characters is written successfully; otherwise, 0.

uint Read ( IntPtr ptr, uint size ) #

Reads the number of bytes from the stream.

Arguments

  • IntPtr ptr - Vector, into which data will be read.
  • uint size - Size of data to read.

Return value

The number of read bytes.

bool ReadBool ( ) #

Reads a boolean value from the stream.

Return value

Data value.

char ReadChar ( ) #

Reads a ASCII character in a binary format (1 byte) from the stream.

Return value

Received character.

dmat4 ReadDMat4 ( ) #

Reads a double matrix from the stream in accordance with the little-endian order.

Return value

Vector value.

double ReadDouble ( ) #

Reads a double floating-point number from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadDoubleArray ( out double[] dest ) #

Reads an array of double floating-point numbers from the stream in accordance with the little-endian order.

Arguments

  • out double[] dest

Return value

1 if the operation was successful; otherwise, 0.

dvec2 ReadDVec2 ( ) #

Reads a 2 component double vector from the stream in accordance with the little-endian order.

Return value

Vector value.

dvec3 ReadDVec3 ( ) #

Reads a 3 component double vector from the stream in accordance with the little-endian order.

Return value

Vector value.

dvec4 ReadDVec4 ( ) #

Reads a 4 component double vector from the stream in accordance with the little-endian order.

Return value

Vector value.

float ReadFloat ( ) #

Reads a floating-point number from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadFloatArray ( out float[] dest ) #

Reads an array of floating-point numbers from the stream in accordance with the little-endian order.

Arguments

  • out float[] dest

Return value

1 if the operation was successful; otherwise, 0.

int ReadInt ( ) #

Reads a signed integer from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadInt2 ( ) #

Reads a compact signed integer from the stream.

Return value

Data value.

int ReadIntArray ( out int[] dest ) #

Reads an array of signed integers from the stream in accordance with the little-endian order.

Arguments

  • out int[] dest

Return value

1 if the operation was successful; otherwise, 0.

ivec2 ReadIVec2 ( ) #

Reads a 2 component integer vector from the stream in accordance with the little-endian order.

Return value

Vector value.

ivec3 ReadIVec3 ( ) #

Reads a 3 component integer vector from the stream in accordance with the little-endian order.

Return value

Vector value.

ivec4 ReadIVec4 ( ) #

Reads a 4 component integer vector from the stream in accordance with the little-endian order.

Return value

Vector value.

int ReadLine ( out char[] str ) #

Reads a line from the stream.

Arguments

  • out char[] str

Return value

Returns string.

string ReadLine ( ) #

Reads a line of non-binary characters from the stream: starting from the current position until the end of line is reached ("\n"). The maximum length of the line is 4096 bytes.

Return value

Received line.

long ReadLong ( ) #

Reads a signed long from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadLongArray ( out llong[] dest ) #

Reads an array of signed longs from the stream in accordance with the little-endian order.

Arguments

  • out llong[] dest

Return value

1 if the operation was successful; otherwise, 0.

mat4 ReadMat4 ( ) #

Reads a matrix from the stream in accordance with the little-endian order.

Return value

Vector value.

mat4 ReadMat44 ( ) #

Reads the first 12 elements of 4x4 matrix from the current stream. The last 4 elements of the matrix are discarded.

Return value

4x4 matrix with 12 read elements (the last four elements are equal to 0 0 0 1).

quat ReadQuat ( ) #

Reads a quaternion from the stream in accordance with the little-endian order.

Return value

Vector value.

short ReadShort ( ) #

Reads a signed short integer from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadShortArray ( out short[] dest ) #

Reads an array of signed short integers from the stream in accordance with the little-endian order.

Arguments

  • out short[] dest

Return value

1 if the operation was successful; otherwise, 0.

uint ReadStream ( Stream dest, uint size ) #

Reads the number of bytes directly from the stream.

Arguments

  • Stream dest - Stream to write data into.
  • uint size - Size of data to be read from the current stream.

Return value

The number of read bytes.

int ReadString ( out char[] str ) #

Reads a string from the stream in accordance with the big-endian order.

Arguments

  • out char[] str

Return value

Returns string.

string ReadString ( ) #

Reads a compact string in a binary format from the stream. Each binary string should be preceded by its length (the string length + the string itself). The string length is written as the compact signed integer.

Return value

Received string.

int ReadString2 ( out char[] str ) #

Reads a string from the stream in accordance with the big-endian order.

Arguments

  • out char[] str

Return value

Returns string.

string ReadString2 ( ) #

Return value

Received string.

string ReadToken ( ) #

Reads a token from the stream. A token is a single word delimited by white space or a string in quotes, for example, "word" or "many words". A token is read starting from the current position up to the white space or line feed ("\n"), or if the first character is a double quote mark (") up to the second double quote mark (returned token will not contain any quotes). The maximum length of the string is 4096 bytes.

Return value

Received token.

int ReadToken ( char[] str, int size ) #

Arguments

  • char[] str
  • int size

byte ReadUChar ( ) #

Reads an unsigned character in a binary format from the stream.

Return value

Unsigned character in a binary format.

uint ReadUInt ( ) #

Reads a unsigned integer from the stream in accordance with the little-endian order.

Return value

Data value.

uint ReadUInt2 ( ) #

Reads a compact unsigned integer from the stream.

Return value

Data value.

int ReadUIntArray ( out uint[] dest ) #

Reads an array of unsigned integers from the stream in accordance with the little-endian order.

Arguments

  • out uint[] dest

Return value

1 if the operation was successful; otherwise, 0.

ushort ReadUShort ( ) #

Reads a unsigned short integer from the stream in accordance with the little-endian order.

Return value

Data value.

int ReadUShortArray ( out ushort[] dest ) #

Reads an array of unsigned short integers from the stream in accordance with the little-endian order.

Arguments

  • out ushort[] dest

Return value

1 if the operation was successful; otherwise, 0.

vec2 ReadVec2 ( ) #

Reads a 2 component vector from the stream in accordance with the little-endian order.

Return value

Vector value.

vec3 ReadVec3 ( ) #

Reads a 3 component vector from the stream in accordance with the little-endian order.

Return value

Vector value.

vec4 ReadVec4 ( ) #

Reads a 4 component vector from the stream in accordance with the little-endian order.

Return value

Vector value.

uint Write ( IntPtr ptr, uint size ) #

Writes the number of bytes to the stream.

Arguments

  • IntPtr ptr - Buffer, from which data will be written.
  • uint size - Size of data to write.

Return value

The number of written bytes.

bool WriteBool ( bool value ) #

Writes the specified boolean value to the stream.

Arguments

  • bool value - Data value to be written.

Return value

true if the operation was successful; otherwise, false.

int WriteChar ( char value ) #

Writes an ASCII character in a binary format (1 byte) to the stream.

Arguments

  • char value - ASCII code of a character to write.

Return value

1 if a character is written successfully; otherwise 0.

int WriteDMat4 ( dmat4 value ) #

Writes a double matrix to the stream in accordance with the little-endian order.

Arguments

  • dmat4 value - A matrix to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteDouble ( double value ) #

Writes a double floating-point number to the stream in accordance with the little-endian order.

Arguments

  • double value - A double value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteDoubleArray ( double[] src ) #

Writes an array of double floating-point numbers to the stream in accordance with the little-endian order.

Arguments

  • double[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteDVec2 ( dvec2 value ) #

Writes a 2 component double vector to the stream in accordance with the little-endian order.

Arguments

  • dvec2 value - Vector value.

Return value

1 if the operation was successful; otherwise, 0.

int WriteDVec3 ( dvec3 value ) #

Writes a 3 component double vector to the stream in accordance with the little-endian order.

Arguments

  • dvec3 value - A dvec3 value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteDVec4 ( dvec4 value ) #

Writes a 4 component double vector to the stream in accordance with the little-endian order.

Arguments

  • dvec4 value - A dvec4 value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteFloat ( float value ) #

Writes a floating-point number to the stream in accordance with the little-endian order.

Arguments

  • float value - A float value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteFloatArray ( float[] src ) #

Writes an array of floating-point numbers to the stream in accordance with the little-endian order.

Arguments

  • float[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteInt ( int value ) #

Writes a signed integer to the stream in accordance with the little-endian order.

Arguments

  • int value - An integer value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteInt2 ( int value ) #

Writes a compact signed integer to the stream.

Arguments

  • int value - A compact signed integer to write.

Return value

1 if the compact integer is written successfully; otherwise, 0.

int WriteIntArray ( int[] src ) #

Writes an array of signed integers to the stream in accordance with the little-endian order.

Arguments

  • int[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteIVec2 ( ivec2 value ) #

Writes a 2 component integer vector to the stream in accordance with the little-endian order.

Arguments

  • ivec2 value - Vector value.

Return value

1 if the operation was successful; otherwise, 0.

int WriteIVec3 ( ivec3 value ) #

Writes a 3 component integer vector to the stream in accordance with the little-endian order.

Arguments

  • ivec3 value - An ivec3 value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteIVec4 ( ivec4 value ) #

Writes a 4 component integer vector to the stream in accordance with the little-endian order.

Arguments

  • ivec4 value - An ivec4 to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteLong ( long value ) #

Writes a signed long to the stream in accordance with the little-endian order.

Arguments

  • long value - A long value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteLongArray ( llong[] src ) #

Writes an array of signed longs to the stream in accordance with the little-endian order.

Arguments

  • llong[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteMat4 ( mat4 value ) #

Writes a matrix to the stream in accordance with the little-endian order.

Arguments

  • mat4 value - A matrix to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteMat44 ( mat4 value ) #

Writes the first 12 elements of 4x4 matrix in a binary format into the current stream. The last 4 elements of the matrix are discarded.

Arguments

  • mat4 value - A 4x4 matrix.

Return value

1 if data is written successfully; otherwise, 0.

int WriteQuat ( quat value ) #

Writes a quaternion to the stream in accordance with the little-endian order.

Arguments

  • quat value - A quaternion to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteShort ( short value ) #

Writes a signed short integer to the stream in accordance with the little-endian order.

Arguments

  • short value - A short integer value to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteShortArray ( short[] src ) #

Writes an array of signed short integers to the stream in accordance with the little-endian order.

Arguments

  • short[] src

Return value

1 if the operation was successful; otherwise, 0.

uint WriteStream ( Stream src, uint size ) #

Writes the number of bytes directly to the stream.

Arguments

  • Stream src - Stream to read data from.
  • uint size - Size of data to be read from the stream.

Return value

The number of written bytes.

int WriteString ( string str ) #

Writes a string in a binary format to the stream. Each binary string should be preceded by its length (4 bytes defining the length of string + the string itself).

Arguments

  • string str - String to write.

Return value

1 if the string is written successfully; otherwise, 0.

int WriteString2 ( string str ) #

Writes a compact string in a binary format to the stream. Each binary string should be preceded by its length (the string length + the string itself). The string length is written as the compact signed integer.

Arguments

  • string str - String to write.

Return value

1 if the string is written successfully; otherwise, 0.

int WriteUChar ( byte value ) #

Writes an unsigned character to the stream.

Arguments

  • byte value - Unsigned character to write.

Return value

1 if the unsigned character is written successfully; otherwise, 0.

int WriteUInt ( uint value ) #

Writes a unsigned integer to the stream in accordance with the little-endian order.

Arguments

  • uint value - Data value.

Return value

1 if the operation was successful; otherwise, 0.

int WriteUInt2 ( uint value ) #

Writes a compact unsigned integer to the stream.

Arguments

  • uint value - Data value.

int WriteUIntArray ( uint[] src ) #

Writes an array of unsigned integers to the stream in accordance with the little-endian order.

Arguments

  • uint[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteUShort ( ushort value ) #

Writes a unsigned short integer to the stream in accordance with the little-endian order.

Arguments

  • ushort value - Unsigned short integer to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteUShortArray ( ushort[] src ) #

Writes an array of unsigned short integers to the stream in accordance with the little-endian order.

Arguments

  • ushort[] src

Return value

1 if the operation was successful; otherwise, 0.

int WriteVec2 ( vec2 value ) #

Writes a 2 component vector to the stream in accordance with the little-endian order.

Arguments

  • vec2 value - Vector value.

Return value

1 if the operation was successful; otherwise, 0.

int WriteVec3 ( vec3 value ) #

Writes a 3 component vector to the stream in accordance with the little-endian order.

Arguments

  • vec3 value - A vec3 to write.

Return value

1 if the operation was successful; otherwise, 0.

int WriteVec4 ( vec4 value ) #

Writes a 4 component vector to the stream in accordance with the little-endian order.

Arguments

  • vec4 value - A vec4 to write.

Return value

1 if the operation was successful; otherwise, 0.
Last update: 2020-04-10
Build: ()