serializer.stringstream - Palamecia/mint GitHub Wiki

Module

load serializer.stringstream

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.

Members

Modifiers Member Description
+ const << Writes the string data to the stream, and returns a reference to the stream.
+ const >> Reads a word from the stream and stores it in data, then returns a referenc...
+ const getChar Returns the next character of the string without moving the read index.
+ const isEmpty Returns true if the current edited string has no more data to read; otherwi...
+ const new Creates a new stream on the str object. If the object is an instance of str...
- final pos Internal read index.
+ const read Returns all remaining data from the string.
+ const readChar Returns the next character of the string and move the read index to the next ...
+ const readLine Returns the next line from the string and move the read index to the next ele...
+ const readLines Returns an iterator on each remaining lines of the string.
+ const readUntil Reads data from the string until delim is found, and returns it. The read i...
+ const readWord Returns the next word of the string and move the read index to the next eleme...
- final str Internal string object.
+ const toString Returns the whole edited string.
+ const write Appends data to the end of the string.

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 a word from the stream and stores it in data, then returns a reference to the stream. Words are separated by whitespace (i.e., all characters for which isSpace returns true).

Leading whitespace are skipped.

Serializer.StringStream.getChar

def (self)

Returns the next character of the string without moving the read index.

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 writed data can then only be retrived by read operations.

Serializer.StringStream.pos

0

Internal read index.

Serializer.StringStream.read

def (self)

Returns all remaining data from the string.

Serializer.StringStream.readChar

def (self)

Returns the next character of the string and move the read index to the next element.

Serializer.StringStream.readLine

def (self)

Returns the next line from the string and move the read index to the next element. Data is read until a '\n' character is read or if the end of stream is detected.

Serializer.StringStream.readLines

def (self)

Returns an iterator on each remaining lines of the string.

Serializer.StringStream.readUntil

def (self, delim)

Reads data from the string until delim is found, and returns it. The read index of the stream is then moved to the first character identified by delim.

Serializer.StringStream.readWord

def (self)

Returns the next word of the string and move the read index to the next element. Words are separated by whitespace (i.e., all characters for which isSpace returns true).

Leading whitespace are skipped.

Serializer.StringStream.str

null

Internal string object.

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.