Class: WritableByteChannel
WritableByteChannel represents an output resource (i.e file) which could be used to sink bytes
A file path can be used to obtain an io:WritableByteChannel
.
An io:WritableByteChannel
can only be obtained using the following method or by providing a native implementation.
It cannot be instantiated.
io:openWritableFile("./files/sample.txt")
- used to obtain an io:WritableByteChannel
from a given file path
write
Isolated Function
Sinks bytes from a given input/output resource.
This is an asynchronous operation. The method might return before writing all the content.
1int|io:Error result = writableByteChannel.write(record, 0);
Parameters
- content byte[ ]
Block of bytes to be written
- offset int
Offset of the provided content, which needs to be kept when writing bytes