Skip to content

serializer.documentstream

Palamecia edited this page Dec 4, 2022 · 4 revisions

Module

load serializer.documentstream

This module provides the Serializer.DocumentStream class which add location informations to read data from a text document.

Packages

Classes

Serializer.DocumentStream

This class creates a conveniant interface for reading and writing data on a text document. It provides informations such as current line and column number.

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...
+ class InvalidDocument This class provides the context of an invalid content exception.
- final column Internal column number.
+ const getCodec Returns the codec that is current assigned to the stream. It correspond to th...
+ const getColumnNumber Returns the column number of the read cursor position.
+ const getLineNumber Returns the line number of the read cursor position.
+ const isEmpty Returns true if the stream has no more data to read; otherwise returns fa...
- final line Internal line number.
+ const new Creates a new stream for reading and writing data using stream.
+ const read Reads all remaining data from the stream, and returns it as a string.
+ const readChar Reads the next character from the stream, and returns it as a string. Data is...
+ const readLine Reads the next line from the stream, and returns it as a string. Data is read...
+ const readLines Returns an iterator on each remaining lines of the stream.
+ const readWord Reads a word from the stream, and returns it as a string. Words are separated...
+ const setCodec Forwards the codec to the underling object.
- final stream Internal underling stream.
+ const toTextStream Returns the internal instance of Serializer.TextStream used for read and writ...
+ const write Writes the content of data to the stream. The write method of the underli...

Serializer.DocumentStream.InvalidDocument

This class provides the context of an invalid content exception.

Inherits

Members

Modifiers Member Description
- final column Internal column number.
- final document Internal document.
- final error Internal error message.
+ const getColumnNumber Returns the error column number.
+ const getDocument Returns the document that raised the error.
+ const getError Returns the error message.
+ const getLineNumber Returns the error line number.
- final line Internal line number.
+ const new Create a new instance of the exception for the given document at the curren...
+ const toString Returns the exception informations as a string.

Descriptions

Serializer.DocumentStream.<<

def (self, data)

Writes the string data to the stream, and returns a reference to the stream. The string is first encoded using the assigned codec (the default is UTF-8) before it is written to the stream.

Serializer.DocumentStream.>>

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.DocumentStream.InvalidDocument.column

0

Internal column number.

Serializer.DocumentStream.InvalidDocument.document

null

Internal document.

Serializer.DocumentStream.InvalidDocument.error

''

Internal error message.

Serializer.DocumentStream.InvalidDocument.getColumnNumber

def (const self)

Returns the error column number.

Serializer.DocumentStream.InvalidDocument.getDocument

def (const self)

Returns the document that raised the error.

Serializer.DocumentStream.InvalidDocument.getError

def (const self)

Returns the error message.

Serializer.DocumentStream.InvalidDocument.getLineNumber

def (const self)

Returns the error line number.

Serializer.DocumentStream.InvalidDocument.line

1

Internal line number.

Serializer.DocumentStream.InvalidDocument.new

def (self, document, error)

Create a new instance of the exception for the given document at the current position with an error message.

Serializer.DocumentStream.InvalidDocument.toString

def (const self)

Returns the exception informations as a string.

Serializer.DocumentStream.column

0

Internal column number.

Serializer.DocumentStream.getCodec

def (const self)

Returns the codec that is current assigned to the stream. It correspond to the codec of the underling stream.

Serializer.DocumentStream.getColumnNumber

def (const self)

Returns the column number of the read cursor position.

Serializer.DocumentStream.getLineNumber

def (const self)

Returns the line number of the read cursor position.

Serializer.DocumentStream.isEmpty

def (const self)

Returns true if the stream has no more data to read; otherwise returns false.

Serializer.DocumentStream.line

1

Internal line number.

Serializer.DocumentStream.new

def (self, stream)

Creates a new stream for reading and writing data using stream.

Serializer.DocumentStream.read

def (self)

Reads all remaining data from the stream, and returns it as a string.

Serializer.DocumentStream.readChar

def (self)

Reads the next character from the stream, and returns it as a string. Data is read until a valid character is read or if the end of stream is detected.

Serializer.DocumentStream.readLine

def (self)

Reads the next line from the stream, and returns it as a string. Data is read until a '\n' character is read or if the end of stream is detected.

Serializer.DocumentStream.readLines

def (self)

Returns an iterator on each remaining lines of the stream.

Serializer.DocumentStream.readWord

def (self)

Reads a word from the stream, and returns it as a string. Words are separated by whitespace (i.e., all characters for which isSpace returns true).

Leading whitespace are skipped.

Serializer.DocumentStream.setCodec

def (self, codec)

Forwards the codec to the underling object.

Serializer.DocumentStream.stream

null

Internal underling stream.

Serializer.DocumentStream.toTextStream

def (self)

Returns the internal instance of Serializer.TextStream used for read and write operations on the document.

Serializer.DocumentStream.write

def (self, data)

Writes the content of data to the stream.

The write method of the underling object is used to write the data.

Clone this wiki locally