Interface

interface IOStream

public interface IOStream <: InputStream & OutputStream {}

Description: Represents the I/O stream interface.

Parent Type:

interface InputStream

public interface InputStream {
    func read(buffer: Array<Byte>): Int64
}

Description: Represents the input stream interface.

func read(Array<Byte>)

func read(buffer: Array<Byte>): Int64

Description: Reads data from the input stream and stores the data in buffer.

Parameters:

  • buffer: Array<Byte>: buffer used to store the data read from the input stream

Returns:

  • Int64: number of bytes of the read data

interface OutputStream

public interface OutputStream {
    func write(buffer: Array<Byte>): Unit
    func flush(): Unit
}

Description: Represents the output stream interface.

func flush()

func flush(): Unit

Description: Clears the buffer. This function provides default implementation. The function body is empty by default.

func write(Array<Byte>)

func write(buffer: Array<Byte>): Unit

Description: Writes data in buffer to the output stream.

Parameters:

  • buffer: Array<Byte>: buffer used to store the data to be written to the output stream

interface Seekable

public interface Seekable {
    prop length: Int64
    prop position: Int64
    prop remainLength: Int64
    func seek(sp: SeekPosition): Int64
}

Description: Moves the cursor.

prop length

prop length: Int64

Description: Returns the total data volume of the current stream.

Type: Int64

prop position

prop position: Int64

Description: Returns the current cursor position.

Type: Int64

prop remainLength

prop remainLength: Int64

Description: Returns the unread data volume in the current stream.

Type: Int64

func seek(SeekPosition)

func seek(sp: SeekPosition): Int64

Description: Moves the cursor to a specified position.

Parameters:

  • sp: SeekPosition: the position to which the cursor is to be moved

Returns:

  • Int64: the offset (in bytes) from the start point of the data in the stream to the position after the cursor is moved