Object -
io
:
ReadableDataChannel
Represents a data channel for reading data.
Constructor
__init
(ReadableByteChannel byteChannel, ByteOrder bOrder)
- byteChannel ReadableByteChannel
-
The channel, which would represent the source to read/write data
- bOrder ByteOrder BE
-
network byte order
Methods
Reads a 16 bit integer.
Reads a 32 bit integer.
Reads a 64 bit integer.
Reads a 32 bit float.
Reads a 64 bit float.
Reads a byte and convert its value to boolean.
Reads the string value represented through the provided number of bytes.
Reads a variable length integer.
Closes the data channel.
Reads a 16 bit integer.
int|io:Error result = dataChannel.readInt16();
-
Return Type
(int | Error) The value of the integer, which is read or else an
io:Error
if any error occurred
Reads a 32 bit integer.
int|io:Error result = dataChannel.readInt32();
-
Return Type
(int | Error) The value of the integer, which is read or else an
io:Error
if any error occurred
Reads a 64 bit integer.
int|io:Error result = dataChannel.readInt64();
-
Return Type
(int | Error) The value of the integer, which is read or else an
io:Error
if any error occurred
Reads a 32 bit float.
float|io:Error result = dataChannel.readFloat32();
-
Return Type
(float | Error) The value of the float which is read or else
io:Error
if any error occurred
Reads a 64 bit float.
float|io:Error result = dataChannel.readFloat64();
-
Return Type
(float | Error) The value of the float which is read or else
io:Error
if any error occurred
Reads a byte and convert its value to boolean.
boolean|io:Error result = dataChannel.readBool();
-
Return Type
(boolean | Error) boolean value which is read or else
io:Error
if any error occurred
Reads the string value represented through the provided number of bytes.
string|io:Error string = dataChannel.readString(10, "UTF-8");
Parameters
- nBytes int
-
Specifies the number of bytes, which represents the string
- encoding string
-
Specifies the char-set encoding of the string
-
Return Type
(string | Error) The value of the string or else
io:Error
if any error occurred
Reads a variable length integer.
int|io:Error result = dataChannel.readVarInt();
-
Return Type
(int | Error) The value of the integer which is read or else
io:Error
if any error occurred