ballerina.io package
public struct ByteChannel
Ballerina ByteChannel represents a channel which will allow I/O operations to be done
-
< ByteChannel > close ( )
Function to close a byte channel
-
< ByteChannel > readAllBytes ( ) ( blob , int )
Function to read all bytes in the given I/O source
Return Variable Data Type Description blob int -
< ByteChannel > readBytes ( int numberOfBytes ) ( blob , int )
Function to read bytes
Parameter Name Data Type Description numberOfBytes int Number of bytes which should be read Return Variable Data Type Description blob int -
< ByteChannel > toCharacterChannel ( string encoding ) ( CharacterChannel )
Function to convert a ByteChannel to CharacterChannel
Parameter Name Data Type Description encoding string The charset/encoding of the content (i.e UTF-8, ASCII) Return Variable Data Type Description CharacterChannel -
< ByteChannel > writeBytes ( blob content , int startOffset ) ( int )
Function to write bytes
Parameter Name Data Type Description content blob Bytes which should be written startOffset int If the bytes need to be written with an offset, the value of that offset Return Variable Data Type Description int
public struct CharacterChannel
Ballerina CharacterChannel represents a channel which will allow to read/write characters
-
< CharacterChannel > closeCharacterChannel ( )
Function to close a character channel
-
< CharacterChannel > readAllCharacters ( ) ( string )
Function to read all characters in the give I/O source
Return Variable Data Type Description string -
< CharacterChannel > readCharacters ( int numberOfChars ) ( string )
Function to read characters
Parameter Name Data Type Description numberOfChars int Number of characters which should be read Return Variable Data Type Description string -
< CharacterChannel > toTextRecordChannel ( string recordSeparator , string fieldSeparator ) ( TextRecordChannel )
Function to convert a CharacterChannel to TextRecordChannel
Parameter Name Data Type Description recordSeparator string Terminating expression to distinguish between records fieldSeparator string Terminating expression to distinguish between fields Return Variable Data Type Description TextRecordChannel -
< CharacterChannel > writeCharacters ( string content , int startOffset ) ( int )
Function to write characters
Parameter Name Data Type Description content string Text content which should be written startOffset int If the content needs to be written with an offset, the value of that offset Return Variable Data Type Description int
public struct TextRecordChannel
Ballerina TextRecordChannel represents a channel which will allow to read/write text records
-
< TextRecordChannel > closeTextRecordChannel ( )
Function to close the text record channel
-
< TextRecordChannel > readTextRecord ( ) ( string[] )
Function to read text records
Return Variable Data Type Description string[] -
< TextRecordChannel > writeTextRecord ( string[] records )
Function to write text records
Parameter Name Data Type Description records string[] Fields which are included in the record