Unigine::Stream Class
Header: | #include <UnigineStreams.h> |
Stream Class
Enums
TYPE#
Name | Description |
---|---|
BLOB = 0 | A stream for blobs. |
FILE = 1 | A stream for files. |
SOCKET = 2 | A stream for sockets. |
USER = 3 | A user stream inherited from StreamBase. |
NUM_STREAMS = 4 | Number of stream types. |
Members
bool isAvailable ( ) const#
Returns the status of the stream.Return value
1 if the stream data is available; otherwise, 0.void setByteOrder ( int order ) #
Sets the endianness of the stream.Arguments
- int order - A value indicating the endianness of the stream: 0 value is for LSB (least significant), 1 is for MSB (most significant).
int getByteOrder ( ) const#
Returns the value indicating the endianness of the stream.Return value
A value indicating the endianness of the stream: 0 value is for LSB (least significant), 1 is for MSB (most significant).bool isError ( ) const#
Returns the status of the stream.Return value
1 if there is a read/write error; otherwise, 0.bool isOpened ( ) const#
Returns the status of the stream.Return value
1 if the stream is opened; otherwise, 0.String gets ( ) #
Reads the stream data from the current position.Return value
Stream data starting from the current position.Stream::TYPE getType ( ) const#
Return the type of the stream.Return value
A value indicating the type of the stream.int puts ( const char * str ) #
Writes a non-binary string of characters to the stream.Arguments
- const char * str - String to write.
Return value
1 if a string of characters is written successfully; otherwise, 0.size_t read ( void * ptr, size_t size ) #
Reads the number of bytes from the stream.Arguments
- void * ptr - Destination buffer pointer.
- size_t size - Size of the buffer, in bytes.
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.Math::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.Math::dvec2 readDVec2 ( ) #
Reads a 2 component double vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::dvec3 readDVec3 ( ) #
Reads a 3 component double vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::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.Math::ivec2 readIVec2 ( ) #
Reads a 2 component integer vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::ivec3 readIVec3 ( ) #
Reads a 3 component integer vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::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 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.Math::mat4 readMat4 ( ) #
Reads a matrix from the stream in accordance with the little-endian order.Return value
Vector value.Math::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).Math::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.size_t readStream ( const Ptr<Stream> & dest, size_t size ) #
Reads the number of bytes directly from the stream.Arguments
- const Ptr<Stream> & dest - Destination stream pointer.
- size_t size - Size of the data in bytes.
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
unsigned char readUChar ( ) #
Reads an unsigned character in a binary format from the stream.Return value
Unsigned character in a binary format.unsigned int readUInt ( ) #
Reads a unsigned integer from the stream in accordance with the little-endian order.Return value
Data value.unsigned int 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.unsigned short 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.Math::vec2 readVec2 ( ) #
Reads a 2 component vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::vec3 readVec3 ( ) #
Reads a 3 component vector from the stream in accordance with the little-endian order.Return value
Vector value.Math::vec4 readVec4 ( ) #
Reads a 4 component vector from the stream in accordance with the little-endian order.Return value
Vector value.size_t write ( const void * ptr, size_t size ) #
Writes the number of bytes to the stream.Arguments
- const void * ptr - Source buffer pointer.
- size_t size - Size of the buffer in bytes.
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.bool 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.bool writeDMat4 ( const Math::dmat4 & value ) #
Writes a double matrix to the stream in accordance with the little-endian order.Arguments
- const Math::dmat4 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeDouble ( double value ) #
Writes a double floating-point number to the stream in accordance with the little-endian order.Arguments
- double value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool 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.bool writeDVec2 ( const Math::dvec2 & value ) #
Writes a 2 component double vector to the stream in accordance with the little-endian order.Arguments
- const Math::dvec2 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeDVec3 ( const Math::dvec3 & value ) #
Writes a 3 component double vector to the stream in accordance with the little-endian order.Arguments
- const Math::dvec3 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeDVec4 ( const Math::dvec4 & value ) #
Writes a 4 component double vector to the stream in accordance with the little-endian order.Arguments
- const Math::dvec4 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeFloat ( float value ) #
Writes a floating-point number to the stream in accordance with the little-endian order.Arguments
- float value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool 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.bool writeInt ( int value ) #
Writes a signed integer to the stream in accordance with the little-endian order.Arguments
- int value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool writeInt2 ( int value ) #
Writes a compact signed integer to the stream.Arguments
- int value - Data value.
Return value
1 if the compact integer is written successfully; otherwise, 0.bool 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.bool writeIVec2 ( const Math::ivec2 & value ) #
Writes a 2 component integer vector to the stream in accordance with the little-endian order.Arguments
- const Math::ivec2 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeIVec3 ( const Math::ivec3 & value ) #
Writes a 3 component integer vector to the stream in accordance with the little-endian order.Arguments
- const Math::ivec3 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeIVec4 ( const Math::ivec4 & value ) #
Writes a 4 component integer vector to the stream in accordance with the little-endian order.Arguments
- const Math::ivec4 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeLong ( long long value ) #
Writes a signed long to the stream in accordance with the little-endian order.Arguments
- long long value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool 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.bool writeMat4 ( const Math::mat4 & value ) #
Writes a matrix to the stream in accordance with the little-endian order.Arguments
- const Math::mat4 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeMat44 ( const Math::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
- const Math::mat4 & value - A 4x4 matrix.
Return value
1 if data is written successfully; otherwise, 0.bool writeQuat ( const Math::quat & value ) #
Writes a quaternion to the stream in accordance with the little-endian order.Arguments
- const Math::quat & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeShort ( short value ) #
Writes a signed short integer to the stream in accordance with the little-endian order.Arguments
- short value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool 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.size_t writeStream ( const Ptr<Stream> & src, size_t size ) #
Writes the number of bytes directly to the stream.Arguments
- const Ptr<Stream> & src - Source stream pointer.
- size_t size - Size of the data in bytes.
Return value
The number of written bytes.bool writeString ( const char * 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
- const char * str - String to write.
Return value
1 if the string is written successfully; otherwise, 0.bool writeString2 ( const char * 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
- const char * str - String to write.
Return value
1 if the string is written successfully; otherwise, 0.bool writeUChar ( unsigned char value ) #
Writes an unsigned character to the stream.Arguments
- unsigned char value - Unsigned character to write.
Return value
1 if the unsigned character is written successfully; otherwise, 0.bool writeUInt ( unsigned int value ) #
Writes a unsigned integer to the stream in accordance with the little-endian order.Arguments
- unsigned int value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool writeUInt2 ( unsigned int value ) #
Writes a compact unsigned integer to the stream.Arguments
- unsigned int value - Data value.
bool 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.bool writeUShort ( unsigned short value ) #
Writes a unsigned short integer to the stream in accordance with the little-endian order.Arguments
- unsigned short value - Data value.
Return value
1 if the operation was successful; otherwise, 0.bool 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.bool writeVec2 ( const Math::vec2 & value ) #
Writes a 2 component vector to the stream in accordance with the little-endian order.Arguments
- const Math::vec2 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeVec3 ( const Math::vec3 & value ) #
Writes a 3 component vector to the stream in accordance with the little-endian order.Arguments
- const Math::vec3 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.bool writeVec4 ( const Math::vec4 & value ) #
Writes a 4 component vector to the stream in accordance with the little-endian order.Arguments
- const Math::vec4 & value - Vector value.
Return value
1 if the operation was successful; otherwise, 0.void read ( char & value ) const#
Arguments
- char & value
bool write ( char value ) const#
Arguments
- char value
void read ( short & value ) const#
Arguments
- short & value
bool write ( short value ) const#
Arguments
- short value
void read ( unsigned short & value ) const#
Arguments
- unsigned short & value
bool write ( unsigned short value ) const#
Arguments
- unsigned short value
void read ( bool & value ) const#
Arguments
- bool & value
bool write ( bool value ) const#
Arguments
- bool value
void read ( int & value ) const#
Arguments
- int & value
bool write ( int value ) const#
Arguments
- int value
void read ( unsigned int & value ) const#
Arguments
- unsigned int & value
bool write ( unsigned int value ) const#
Arguments
- unsigned int value
void read ( long long & value ) const#
Arguments
- long long & value
bool write ( long long value ) const#
Arguments
- long long value
void read ( float & value ) const#
Arguments
- float & value
bool write ( float value ) const#
Arguments
- float value
void read ( double & value ) const#
Arguments
- double & value
bool write ( double value ) const#
Arguments
- double value
bool write ( const char * value ) const#
Arguments
- const char * value
void read ( Math::vec2 & value ) const#
Arguments
- Math::vec2 & value
bool write ( const Math::vec2 & value ) const#
Arguments
- const Math::vec2 & value
void read ( Math::vec3 & value ) const#
Arguments
- Math::vec3 & value
bool write ( const Math::vec3 & value ) const#
Arguments
- const Math::vec3 & value
void read ( Math::vec4 & value ) const#
Arguments
- Math::vec4 & value
bool write ( const Math::vec4 & value ) const#
Arguments
- const Math::vec4 & value
void read ( Math::dvec2 & value ) const#
Arguments
- Math::dvec2 & value
bool write ( const Math::dvec2 & value ) const#
Arguments
- const Math::dvec2 & value
void read ( Math::dvec3 & value ) const#
Arguments
- Math::dvec3 & value
bool write ( const Math::dvec3 & value ) const#
Arguments
- const Math::dvec3 & value
void read ( Math::dvec4 & value ) const#
Arguments
- Math::dvec4 & value
bool write ( const Math::dvec4 & value ) const#
Arguments
- const Math::dvec4 & value
void read ( Math::ivec2 & value ) const#
Arguments
- Math::ivec2 & value
bool write ( const Math::ivec2 & value ) const#
Arguments
- const Math::ivec2 & value
void read ( Math::ivec3 & value ) const#
Arguments
- Math::ivec3 & value
bool write ( const Math::ivec3 & value ) const#
Arguments
- const Math::ivec3 & value
void read ( Math::ivec4 & value ) const#
Arguments
- Math::ivec4 & value
bool write ( const Math::ivec4 & value ) const#
Arguments
- const Math::ivec4 & value
void read ( Math::mat4 & value ) const#
Arguments
- Math::mat4 & value
bool write ( const Math::mat4 & value ) const#
Arguments
- const Math::mat4 & value
void read ( Math::dmat4 & value ) const#
Arguments
- Math::dmat4 & value
bool write ( const Math::dmat4 & value ) const#
Arguments
- const Math::dmat4 & value
void read ( Math::quat & value ) const#
Arguments
- Math::quat & value
bool write ( const Math::quat & value ) const#
Arguments
- const Math::quat & value
Last update:
24.11.2020
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter