Ballerina API Documentation

Functions of ballerina.io package

public function <ByteChannel channel> close()

Function to close the byte channel

Receiver:

Receiver NameData TypeDescription
channelByteChannel

public function <CharacterChannel channel> closeCharacterChannel()

Function to close character channel

Receiver:

Receiver NameData TypeDescription
channelCharacterChannel

public function <TextRecordChannel channel> closeTextRecordChannel()

Function to close the text record channel

Receiver:

Receiver NameData TypeDescription
channelTextRecordChannel

public function <ByteChannel channel> readBytes(int numberOfBytes) (blob, int)

Function to read bytes

Receiver:

Receiver NameData TypeDescription
channelByteChannelnumberOfBytes: number of bytes which should be read

Parameters:

Parameter NameData TypeDescription
numberOfBytesintnumber of bytes which should be read

Return Parameters:

Return VariableData TypeDescription
blobblob: the bytes which were read
intblob: the bytes which were read

public function <CharacterChannel channel> readCharacters(int numberOfChars) (string)

Function to read characters

Receiver:

Receiver NameData TypeDescription
channelCharacterChannelnumberOfChars: number of characters which should be read

Parameters:

Parameter NameData TypeDescription
numberOfCharsintnumber of characters which should be read

Return Parameters:

Return VariableData TypeDescription
stringthe characters which will be read

public function <TextRecordChannel channel> readTextRecord() (string[])

Function to read text records

Receiver:

Receiver NameData TypeDescription
channelTextRecordChannel

Return Parameters:

Return VariableData TypeDescription
string[]Fields listed in the record

public function <ByteChannel channel> toCharacterChannel(string encoding) (CharacterChannel)

Function to convert ByteChannel to CharacterChannel

Receiver:

Receiver NameData TypeDescription
channelByteChannelencoding: the charset/encoding of the content (i.e UTF-8, ASCCI)

Parameters:

Parameter NameData TypeDescription
encodingstringthe charset/encoding of the content (i.e UTF-8, ASCCI)

Return Parameters:

Return VariableData TypeDescription
CharacterChannelCharacterChannel converted from ByteChannel

public function <CharacterChannel channel> toTextRecordChannel(string recordSeparator, string fieldSeparator) (TextRecordChannel)

Function to convert CharacterChannel to TextRecordChannel

Receiver:

Receiver NameData TypeDescription
channelCharacterChannelrecordSeparator: terminating expression to distingush between records

Parameters:

Parameter NameData TypeDescription
recordSeparatorstringterminating expression to distingush between records
fieldSeparatorstringterminating expression to ditingish between feilds

Return Parameters:

Return VariableData TypeDescription
TextRecordChannelTextRecordChannel converted from CharacterChannel

public function <ByteChannel channel> writeBytes(blob content, int startOffset) (int)

Function to write bytes

Receiver:

Receiver NameData TypeDescription
channelByteChannelcontent: bytes which should be written

Parameters:

Parameter NameData TypeDescription
contentblobbytes which should be written
startOffsetintcontent: bytes which should be written

Return Parameters:

Return VariableData TypeDescription
intint: number of bytes written

public function <CharacterChannel channel> writeCharacters(string content, int startOffset) (int)

Function to write characters

Receiver:

Receiver NameData TypeDescription
channelCharacterChannelcontent: text content which should be written

Parameters:

Parameter NameData TypeDescription
contentstringtext content which should be written
startOffsetintif the content needs to be written with an offset

Return Parameters:

Return VariableData TypeDescription
intint: number of characters written

public function <TextRecordChannel channel> writeTextRecord(string[] records)

Function to write text records

Receiver:

Receiver NameData TypeDescription
channelTextRecordChannelrecords: feilds which are included in the record

Parameters:

Parameter NameData TypeDescription
recordsstring[]feilds which are included in the record


Structs of ballerina.io package

public struct ByteChannel

Ballerina ByteChannel represents a channel which will allow I/O operations to be done

public struct CharacterChannel

Ballerina CharacterChannel reprsents a channel which will allow reading/writing characters

public struct TextRecordChannel

Ballerina TextRecordChannel represents a channel which will allow read/write text records


Menu

  • Functions
    • <ByteChannel> close()
    • <CharacterChannel> closeCharacterChannel()
    • <TextRecordChannel> closeTextRecordChannel()
    • <ByteChannel> readBytes(int numberOfBytes) (blob , int )
    • <CharacterChannel> readCharacters(int numberOfChars) (string )
    • <TextRecordChannel> readTextRecord() (string[] )
    • <ByteChannel> toCharacterChannel(string encoding) (CharacterChannel )
    • <CharacterChannel> toTextRecordChannel(string recordSeparator, string fieldSeparator) (TextRecordChannel )
    • <ByteChannel> writeBytes(blob content, int startOffset) (int )
    • <CharacterChannel> writeCharacters(string content, int startOffset) (int )
    • <TextRecordChannel> writeTextRecord(string[] records)
  • Structs
    • ByteChannel
    • CharacterChannel
    • TextRecordChannel

Copyright 2017 Ballerina API Documentation