Object -
io
:
ReadableByteChannel
ReadableByteChannel represents an input resource (i.e file). which could be used to source bytes.
Methods
Source bytes from a given input/output resource. The number of bytes returned will be < 0 if the file reached its end.
This operation will be asynchronous in which the total number of required bytes might not be returned at a given
time. An
io:EofError
will return once the channel reaches the end.
byte[]|io:Error result = readableByteChannel.read(1000);
Encodes a given
ReadableByteChannel
using the Base64 encoding scheme.
ReadableByteChannel|Error encodedChannel = readableByteChannel.base64Encode();
Decodes a given
ReadableByteChannel
using the Base64 encoding scheme.
ReadableByteChannel|Error encodedChannel = readableByteChannel.base64Decode();
Closes a given
ReadableByteChannel
.
io:Error? err = readableByteChannel.close();
Source bytes from a given input/output resource. The number of bytes returned will be < 0 if the file reached its end.
This operation will be asynchronous in which the total number of required bytes might not be returned at a given
time. An
io:EofError
will return once the channel reaches the end.
byte[]|io:Error result = readableByteChannel.read(1000);
Parameters
- nBytes int
-
A positive integer. Represents the number of bytes, which should be read
-
Return Type
(byte[] | Error) Content (the number of bytes) read, an
EofError
once the channel reaches the end or else anio:Error
Encodes a given
ReadableByteChannel
using the Base64 encoding scheme.
ReadableByteChannel|Error encodedChannel = readableByteChannel.base64Encode();
-
Return Type
(ReadableByteChannel | Error) An encoded
ReadableByteChannel
or else anio:Error
Decodes a given
ReadableByteChannel
using the Base64 encoding scheme.
ReadableByteChannel|Error encodedChannel = readableByteChannel.base64Decode();
-
Return Type
(ReadableByteChannel | Error) A decoded
ReadableByteChannel
or else anio:Error