up: IO     index Zimbu documentation

CLASS IO.Writer @abstract @public

summary

     

Abstract class that implements I_Writer while only requiring subclasses to implement write(string) by providing the writeByte(), writeChar() and print() implementations.

Also provides methods to convert int/bool/status to string.

 
Implements IO.I_ByteWriter
Implements IO.I_CharWriter
Implements IO.I_Writer
 
$write(text) status @public  Writes text.
$write(text) status @public  Writes text converted to a string.
$write(number) status @public  Writes number as a decimal number.
$write(number) status @public  Writes number as a decimal number.
$write(number) status @public  Writes number as a decimal number.
$write(flag) status @public  Writes flag as "TRUE" or "FALSE".
$write(ok) status @public  Writes ok as "FAIL" or "OK".
$write(arg) status @public  Writes arg depending on its actual type. Returns FAIL or OK.
$writeByte(byte) status @public  Writes byte as-is
$writeChar(char) status @public  Writes char as a UTF-8 byte sequence.
$print(text) status @public  Writes text and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(flag) status @public  Writes flag as "TRUE" or "FALSE" and appends a newline. Returns FAIL or OK.
$print(ok) status @public  Writes ok as "FAIL" or "OK" and appends a newline. Returns FAIL or OK.
$print(arg) status @public  Writes arg depending on its actual type and appends a newline. Returns FAIL or OK.
$print() status @public  Writes a newline and returns FAIL or OK.
$format(fmt, arguments) status @public  Formats the string and writes it with a newline appended.
 
Known subclasses:
     
 

members (alphabetically)

     

FUNC $format(string fmt, dyn arguments) status @public

     

Formats the string and writes it with a newline appended.

FUNC $print(string text) status @public

     

Writes text and appends a newline. Returns FAIL or OK.

FUNC $print(int number) status @public

     

Writes number and appends a newline. Returns FAIL or OK.

FUNC $print(nat number) status @public

     

Writes number and appends a newline. Returns FAIL or OK.

FUNC $print(float number) status @public

     

Writes number and appends a newline. Returns FAIL or OK.

FUNC $print(bool flag) status @public

     

Writes flag as "TRUE" or "FALSE" and appends a newline. Returns FAIL or OK.

FUNC $print(status ok) status @public

     

Writes ok as "FAIL" or "OK" and appends a newline. Returns FAIL or OK.

FUNC $print(dyn arg) status @public

     

Writes arg depending on its actual type and appends a newline. Returns FAIL or OK.

For a type that does not have a ToString() method the type name is printed, as with arg.ToString().

If arg is NIL then "NIL" is written.

FUNC $print() status @public

     

Writes a newline and returns FAIL or OK.

FUNC $write(string text) status @abstract @public

     

Writes text.

Returns FAIL when the text could not be written.

FUNC $write(byteString text) status @default @public

     

Writes text converted to a string.

Returns FAIL when the text could not be written.

FUNC $write(int number) status @public

     

Writes number as a decimal number.

Returns FAIL when the number could not be written.

FUNC $write(nat number) status @public

     

Writes number as a decimal number.

Returns FAIL when the number could not be written.

FUNC $write(float number) status @public

     

Writes number as a decimal number.

Returns FAIL when the number could not be written.

FUNC $write(bool flag) status @public

     

Writes flag as "TRUE" or "FALSE".

Returns FAIL when the text could not be written.

FUNC $write(status ok) status @public

     

Writes ok as "FAIL" or "OK".

Returns FAIL when the text could not be written.

FUNC $write(dyn arg) status @public

     

Writes arg depending on its actual type. Returns FAIL or OK.

For a type that does not have a ToString() method the type name is printed, as with arg.ToString().

If arg is NIL then "NIL" is written.

FUNC $writeByte(int byte) status @default @public

     

Writes byte as-is

Only the lower 8 bits of byte are used, the rest is ignored. Returns FAIL when the byte could not be written.

FUNC $writeChar(int char) status @public

     

Writes char as a UTF-8 byte sequence.

Throws E.OutOfRange when char is < 0 or > 0x10ffff. Returns FAIL when the character could not be written.

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0