-
Notifications
You must be signed in to change notification settings - Fork 1
serializer.text stream
load serializer.text-stream
This module provides the Serializer.TextStream class which implement a stream interface for reading and writing text on any kind of object.
This class provides an interface to use any object as a stream for reading and writing text.
| 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 reference ... |
const |
getCodec | Returns the codec that is current assigned to the stream. If the stream use t... |
const |
isEmpty | Returns true if the stream has no more data to read; otherwise returns false. ... |
const |
new | Creates a new stream on the stream object. If the stream object provides both ``... |
const |
read | Reads all remaining data from the stream, and returns it as a string or returns ``... |
const |
readChar | Reads the next character from the stream, and returns it as a string or returns ``... |
const |
readLine | Reads the next line from the stream, and returns it as a string or returns none... |
const |
readLines | Returns an iterator on each remaining lines of the stream. |
const |
readUntil | Reads data from the stream until delim is found and returns it as a string or... |
const |
readWord | Reads a word from the stream, and returns it as a string or returns none if n... |
const |
setCodec | Sets the codec for this stream to codec. The codec is used for decoding any d... |
const |
write | Writes the content of data to the stream. The write method of the underlying ... |
| Modifiers | Member | Description |
|---|---|---|
final |
byteBuffer | Internal read byte buffer. |
final |
bytePos | Internal read byte buffer offset. |
final |
charBuffer | Internal read char buffer. |
final |
charPos | Internal read char buffer offset. |
final |
codec | Internal text codec. |
final const
|
decode | Refill the internal read char buffer with some data from the codec. Returns true... |
final |
isSourceExhausted | |
final const
|
refill | Refill the internal read byte buffer with some data from the stream. Returns ``... |
final |
stream | Internal underlying stream. |
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.
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.
null
Internal read byte buffer.
0
Internal read byte buffer offset.
''
Internal read char buffer.
0
Internal read char buffer offset.
null
Internal text codec.
def (self)
Refill the internal read char buffer with some data from the codec. Returns true if decoded data were added to
the read buffer; otherwise returns false.
def (const self)
Returns the codec that is current assigned to the stream. If the stream use the default codec (UTF-8), null is
returned.
def (const self)
Returns true if the stream has no more data to read; otherwise returns false.
The underlying stream may be checked with one of those methods in the following order: isEmpty, isOver or
atEnd. If none of these methods are defined, false is returned.
def (self)
def (self, stream, codec = Codec.TextCodec ())
Creates a new stream on the stream object.
If the stream object provides both readSome, read and write methods, the object is used as is; otherwise
an instance of Serializer.BufferedStream is created to provide these methods.
The codec parameter is used to specify the text codec to use for reading and writing text.
If stream is not a valid object, none is returned.
def (self)
Reads all remaining data from the stream, and returns it as a string or returns none if no more character is
available on the stream.
def (self)
Reads the next character from the stream, and returns it as a string or returns none if no more character is
available on the stream. Data is read until a valid character is decoded or if the end of stream is detected.
def (self)
Reads the next line from the stream, and returns it as a string or returns none if no more character is
available on the stream. Data is read until a '\n' character is read or if the end of stream is detected.
def (self)
Returns an iterator on each remaining lines of the stream.
def (self, delim)
Reads data from the stream until delim is found and returns it as a string or returns none if no more
character is available on the stream. The delimiter is consumed but is not included in the returned string. Data
is read until the delimiter is read or if the end of stream is detected.
def (self)
Reads a word from the stream, and returns it as a string or returns none if no more character is available on
the stream. Words are separated by whitespace (i.e., all characters for which isSpace returns true). Leading
whitespace are skipped.
def (self)
Refill the internal read byte buffer with some data from the stream. Returns true if raw data were added to the
read buffer; otherwise returns false.
def (self, codec)
Sets the codec for this stream to codec. The codec is used for decoding any data that is read from the file,
and for encoding any data that is written.
null
Internal underlying stream.
def (self, data)
Writes the content of data to the stream.
The write method of the underlying object is used to write the data.
- Introduction
- Variables
-
Built-in-types
- Built-in-types#none
- Built-in-types#null
- Built-in-types#boolean
- Built-in-types#number
- Built-in-types#string
- Built-in-types#regex
- Built-in-types#array
- Built-in-types#hash
- Built-in-types#iterator
- Built-in-types#async_iterator
- Built-in-types#package
- Built-in-types#function
- Built-in-types#coroutine
- Built-in-types#library
- Built-in-types#libobject
- Arithmetic-operations
- Type-casting
- Control-structures
- Function-definition
- User-defined-types
- Work-with-modules