serializer.string stream - Palamecia/mint GitHub Wiki

Module serializer.string-stream

Description

load serializer.string-stream

This module provides the Serializer.StringStream class which allow to use a string object as a stream.

Packages

Classes

Serializer.StringStream

This class provides an interface to use an instance of string as a stream.

Public members

Modifiers Member Description
const << Writes the string data to the stream, and returns a reference to the stream.
const >> Reads the remaining data from the stream and stores it in data, then returns ...
const isEmpty Returns true if the current edited string has no more data to read; otherwise...
const new Creates a new stream on the str object. If the object is an instance of strin...
const read Returns all remaining data from the string as an instance of Serializer.Strin...
const readSome Returns at most count bytes from the string as an instance of Serializer.Stri...
const toString Returns the whole edited string.
const write Appends data to the end of the string. The data parameter should be an instan...

Private members

Modifiers Member Description
final bytePos Internal read byte buffer offset.
final charBuffer Internal read char buffer.
@ const g_lib Global library handle

Descriptions

Serializer.StringStream.<<

def (self, data)

Writes the string data to the stream, and returns a reference to the stream.

Serializer.StringStream.>>

def (self, data)

Reads the remaining data from the stream and stores it in data, then returns a reference to the stream.

Serializer.StringStream.bytePos

0

Internal read byte buffer offset.

Serializer.StringStream.charBuffer

null

Internal read char buffer.

Serializer.StringStream.g_lib

lib ('libmint-serializer')

Global library handle

Serializer.StringStream.isEmpty

def (const self)

Returns true if the current edited string has no more data to read; otherwise returns false.

Serializer.StringStream.new

def (self, str)

Creates a new stream on the str object. If the object is an instance of string, it will be directly used to be updated on write operations; otherwise the object is cast to string using the toString method. The written data can then only be retrieved by read operations.

Serializer.StringStream.read

def (self)

Returns all remaining data from the string as an instance of Serializer.DataStream.

Serializer.StringStream.readSome

def (self, count)

Returns at most count bytes from the string as an instance of Serializer.DataStream.

Serializer.StringStream.toString

def (const self)

Returns the whole edited string.

Serializer.StringStream.write

def (self, data)

Appends data to the end of the string. The data parameter should be an instance of Serializer.DataStream encoding the string as an UTF-8 sequence of bytes.