SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# IO:TextRider

This is a port of the writer part of TextRider to IO. Reader and scanner were dropped. Don't use the riders with non-blocking channels.

### Import List

        CharClass
        IO
        LRealStr
        Object
        Object

Class List
Writer |

Class Summary: Writer [Detail]
      +--IO:TextRider.Writer
Field Summary
channel-: ByteChannel The channel on which this writer is operating.
error-: Error If any of the write methods encounters an error, then the corresponding exception is stored here.
Constructor Summary
ConnectWriter(ByteChannel): Writer
InitWriter(Writer, ByteChannel)
Method Summary
SetEol(ARRAY OF CHAR, INTEGER) Sets new end of line marker.
WriteBool(BOOLEAN)
WriteChar(CHAR)
WriteHex(LONGINT, LONGINT)
WriteInt(INTEGER, LONGINT)
WriteLInt(LONGINT, LONGINT)
WriteLReal(LONGREAL, LONGINT, LONGINT) Writes the value lreal in the format produced by LRealStr.RealToFloat.
WriteLRealEng(VAR LONGREAL, LONGINT, LONGINT) Writes the value lreal in the format produced by LRealStr.RealToEng.
WriteLRealFix(VAR LONGREAL, LONGINT, LONGINT) Writes the value lreal in the format produced by LRealStr.RealToFixed.
WriteLn() Write a newline.
WriteObject(Object)
WriteReal(REAL, LONGINT, LONGINT) As Writer.WriteLReal.
WriteRealEng(REAL, LONGINT, LONGINT) As Writer.WriteLRealEng.
WriteRealFix(REAL, LONGINT, LONGINT) As Writer.WriteLRealFix.
WriteSInt(SHORTINT, LONGINT)
WriteSet(SET) Write s in Oberon-2 set notation.
WriteString(ARRAY OF CHAR)
WriteStringRegion(ARRAY OF CHAR, LONGINT, LONGINT)

Constant Summary
maxLengthEol Maximum length of an end of line character sequence.

Class Detail: Writer

Field Detail

### channel

    FIELD channel-: ByteChannel

> The channel on which this writer is operating.

### error

    FIELD error-: Error

> If any of the write methods encounters an error, then the corresponding exception is stored here. This field is sticky. That is, is stays NIL until the first error, and it keeps the first error's exception.

Constructor Detail

### ConnectWriter

    PROCEDURE ConnectWriter(ch: ByteChannel): Writer

> Pre-condition: ch is in blocking mode.

### InitWriter

    PROCEDURE InitWriter(w: Writer;
                         ch: ByteChannel)

Method Detail

### SetEol

    PROCEDURE (w: Writer) SetEol(marker: ARRAY OF CHAR;
                     markerLen: INTEGER)

> Sets new end of line marker. If the passed string marker does not fit into the writer's field ``w.eol`', then nothing is done. The empty marker is permitted. The default value for newly created writer is CharClass.systemEol.

> Pre-condition: (0 <= markerLen < LEN (marker)) & (markerLen <= maxLengthEol)

### WriteBool

    PROCEDURE (w: Writer) WriteBool(bool: BOOLEAN)

### WriteChar

    PROCEDURE (w: Writer) WriteChar(ch: CHAR)

### WriteHex

    PROCEDURE (w: Writer) WriteHex(lint: LONGINT;
                       d: LONGINT)

### WriteInt

    PROCEDURE (w: Writer) WriteInt(int: INTEGER;
                       n: LONGINT)

### WriteLInt

    PROCEDURE (w: Writer) WriteLInt(lint: LONGINT;
                        n: LONGINT)

### WriteLReal

    PROCEDURE (w: Writer) WriteLReal(lreal: LONGREAL;
                         n: LONGINT;
                         k: LONGINT)

> Writes the value lreal in the format produced by LRealStr.RealToFloat.

### WriteLRealEng

    PROCEDURE (w: Writer) WriteLRealEng(VAR lreal: LONGREAL;
                            n: LONGINT;
                            k: LONGINT)

> Writes the value lreal in the format produced by LRealStr.RealToEng.

### WriteLRealFix

    PROCEDURE (w: Writer) WriteLRealFix(VAR lreal: LONGREAL;
                            n: LONGINT;
                            k: LONGINT)

> Writes the value lreal in the format produced by LRealStr.RealToFixed.

### WriteLn

    PROCEDURE (w: Writer) WriteLn()

> Write a newline.

### WriteObject

    PROCEDURE (w: Writer) WriteObject(obj: Object)

### WriteReal

    PROCEDURE (w: Writer) WriteReal(real: REAL;
                        n: LONGINT;
                        k: LONGINT)

> As Writer.WriteLReal.

### WriteRealEng

    PROCEDURE (w: Writer) WriteRealEng(real: REAL;
                           n: LONGINT;
                           k: LONGINT)

> As Writer.WriteLRealEng.

### WriteRealFix

    PROCEDURE (w: Writer) WriteRealFix(real: REAL;
                           n: LONGINT;
                           k: LONGINT)

> As Writer.WriteLRealFix.

### WriteSInt

    PROCEDURE (w: Writer) WriteSInt(sint: SHORTINT;
                        n: LONGINT)

### WriteSet

    PROCEDURE (w: Writer) WriteSet(s: SET)

> Write s in Oberon-2 set notation.

### WriteString

    PROCEDURE (w: Writer) WriteString(s: ARRAY OF CHAR)

### WriteStringRegion

    PROCEDURE (w: Writer) WriteStringRegion(s: ARRAY OF CHAR;
                                start: LONGINT;
                                end: LONGINT)

Constant Detail

### maxLengthEol

    CONST maxLengthEol

> Maximum length of an end of line character sequence. This value is system dependent, and always larger or equal to 2.