# IO:BinaryRider

### Import List

        IO
        Object
        Object

Class List
Reader |
Writer |

Class Summary: Reader [Detail]

      +--IO:BinaryRider.Reader

Field Summary
byteOrder-: SHORTINT Endian settings for the reader.
channel-: ByteChannel The channel on which this reader is operating.
Constructor Summary
ConnectReader(ByteChannel): Reader
InitReader(Reader, ByteChannel, SHORTINT)
Method Summary
ReadBool(VAR BOOLEAN)
ReadBytes(VAR ARRAY OF BYTE, LONGINT, LONGINT) Read the bytes according to the native machine byte order.
[ReadBytesOrdered](VAR ARRAY OF BYTE)
ReadChar(VAR CHAR)
ReadInt(VAR INTEGER)
ReadLChar(VAR LONGCHAR)
ReadLInt(VAR LONGINT)
ReadLReal(VAR LONGREAL)
ReadLString(VAR ARRAY OF LONGCHAR) The string s is filled until ``0X`' is encountered, there are no more characters in the channel, or the string is filled.
ReadNum(VAR LONGINT)
ReadReal(VAR REAL)
ReadSInt(VAR SHORTINT)
ReadSet(VAR SET)
ReadStr(VAR String)
ReadString(VAR ARRAY OF CHAR) The string s is filled until ``0X`' is encountered, there are no more characters in the channel, or the string is filled.
SetByteOrder(SHORTINT)
SetPos(LONGINT)

Class Summary: Writer [Detail]

      +--IO:BinaryRider.Writer

Field Summary
byteOrder-: SHORTINT Endian settings for the writer.
channel-: ByteChannel The channel on which this writer is operating.
Constructor Summary
ConnectWriter(ByteChannel): Writer
InitWriter(Writer, ByteChannel, SHORTINT)
Method Summary
SetByteOrder(SHORTINT)
SetPos(LONGINT)
WriteBool(BOOLEAN)
WriteBytes(ARRAY OF BYTE, LONGINT, LONGINT)
WriteChar(CHAR)
WriteInt(INTEGER)
WriteLChar(LONGCHAR)
WriteLInt(LONGINT)
WriteLReal(LONGREAL)
WriteLString(ARRAY OF LONGCHAR) The terminating ``0X`' is also written.
WriteNum(LONGINT) Write integers in a compressed and portable format.
[WriteOrdered](VAR ARRAY OF BYTE)
WriteReal(REAL)
WriteSInt(SHORTINT)
WriteSet(SET)
WriteStr(String)
WriteString(ARRAY OF CHAR) Note: The terminating ``0X`' is also written.

Constant Summary
bigEndian Read/write most significant byte first.
littleEndian Read/write least significant byte first.
nativeEndian Do whatever the host machine uses.

Class Detail: Reader

Field Detail

### byteOrder

    FIELD byteOrder-: SHORTINT

> Endian settings for the reader.

### channel

    FIELD channel-: ByteChannel

> The channel on which this reader is operating.

Constructor Detail

### ConnectReader

    PROCEDURE ConnectReader(ch: ByteChannel): Reader

> Pre-condition: ch is in blocking mode.

### InitReader

    PROCEDURE InitReader(r: Reader;
                         ch: ByteChannel;
                         byteOrder: SHORTINT)

Method Detail

### ReadBool

    PROCEDURE (r: Reader) ReadBool(VAR bool: BOOLEAN)
      RAISES Error;

### ReadBytes

    PROCEDURE (r: Reader) ReadBytes(VAR x: ARRAY OF BYTE;
                        start: LONGINT;
                        n: LONGINT)
      RAISES Error;

> Read the bytes according to the native machine byte order.

### ReadBytesOrdered

    PROCEDURE (r: Reader) [ReadBytesOrdered](VAR x: ARRAY OF BYTE)
      RAISES Error;

### ReadChar

    PROCEDURE (r: Reader) ReadChar(VAR ch: CHAR)
      RAISES Error;

### ReadInt

    PROCEDURE (r: Reader) ReadInt(VAR int: INTEGER)
      RAISES Error;

### ReadLChar

    PROCEDURE (r: Reader) ReadLChar(VAR ch: LONGCHAR)
      RAISES Error;

### ReadLInt

    PROCEDURE (r: Reader) ReadLInt(VAR lint: LONGINT)
      RAISES Error;

### ReadLReal

    PROCEDURE (r: Reader) ReadLReal(VAR lreal: LONGREAL)
      RAISES Error;

### ReadLString

    PROCEDURE (r: Reader) ReadLString(VAR s: ARRAY OF LONGCHAR)
      RAISES Error;

> The string s is filled until ``0X`' is encountered, there are no more characters in the channel, or the string is filled. s is always terminated with ``0X`'.

### ReadNum

    PROCEDURE (r: Reader) ReadNum(VAR num: LONGINT)
      RAISES Error;

### ReadReal

    PROCEDURE (r: Reader) ReadReal(VAR real: REAL)
      RAISES Error;

### ReadSInt

    PROCEDURE (r: Reader) ReadSInt(VAR sint: SHORTINT)
      RAISES Error;

### ReadSet

    PROCEDURE (r: Reader) ReadSet(VAR s: SET)
      RAISES Error;

### ReadStr

    PROCEDURE (r: Reader) ReadStr(VAR s: String)
      RAISES Error;

### ReadString

    PROCEDURE (r: Reader) ReadString(VAR s: ARRAY OF CHAR)
      RAISES Error;

> The string s is filled until ``0X`' is encountered, there are no more characters in the channel, or the string is filled. s is always terminated with ``0X`'.

### SetByteOrder

    PROCEDURE (r: Reader) SetByteOrder(order: SHORTINT)

### SetPos

    PROCEDURE (r: Reader) SetPos(newPos: LONGINT)
      RAISES Error;

Class Detail: Writer

Field Detail

### byteOrder

    FIELD byteOrder-: SHORTINT

> Endian settings for the writer.

### channel

    FIELD channel-: ByteChannel

> The channel on which this writer is operating.

Constructor Detail

### ConnectWriter

    PROCEDURE ConnectWriter(ch: ByteChannel): Writer

> Pre-condition: ch is in blocking mode.

### InitWriter

    PROCEDURE InitWriter(w: Writer;
                         ch: ByteChannel;
                         byteOrder: SHORTINT)

Method Detail

### SetByteOrder

    PROCEDURE (w: Writer) SetByteOrder(order: SHORTINT)

### SetPos

    PROCEDURE (w: Writer) SetPos(newPos: LONGINT)
      RAISES Error;

### WriteBool

    PROCEDURE (w: Writer) WriteBool(bool: BOOLEAN)
      RAISES Error;

### WriteBytes

    PROCEDURE (w: Writer) WriteBytes(x: ARRAY OF BYTE;
                         start: LONGINT;
                         n: LONGINT)
      RAISES Error;

### WriteChar

    PROCEDURE (w: Writer) WriteChar(ch: CHAR)
      RAISES Error;

### WriteInt

    PROCEDURE (w: Writer) WriteInt(int: INTEGER)
      RAISES Error;

### WriteLChar

    PROCEDURE (w: Writer) WriteLChar(ch: LONGCHAR)
      RAISES Error;

### WriteLInt

    PROCEDURE (w: Writer) WriteLInt(lint: LONGINT)
      RAISES Error;

### WriteLReal

    PROCEDURE (w: Writer) WriteLReal(lreal: LONGREAL)
      RAISES Error;

### WriteLString

    PROCEDURE (w: Writer) WriteLString(s: ARRAY OF LONGCHAR)
      RAISES Error;

> The terminating ``0X`' is also written.

### WriteNum

    PROCEDURE (w: Writer) WriteNum(lint: LONGINT)
      RAISES Error;

> Write integers in a compressed and portable format.

### WriteOrdered

    PROCEDURE (w: Writer) [WriteOrdered](VAR x: ARRAY OF BYTE)
      RAISES Error;

### WriteReal

    PROCEDURE (w: Writer) WriteReal(real: REAL)
      RAISES Error;

### WriteSInt

    PROCEDURE (w: Writer) WriteSInt(sint: SHORTINT)
      RAISES Error;

### WriteSet

    PROCEDURE (w: Writer) WriteSet(s: SET)
      RAISES Error;

### WriteStr

    PROCEDURE (w: Writer) WriteStr(s: String)
      RAISES Error;

### WriteString

    PROCEDURE (w: Writer) WriteString(s: ARRAY OF CHAR)
      RAISES Error;

> Note: The terminating ``0X`' is also written.

Constant Detail

### bigEndian

    CONST bigEndian

> Read/write most significant byte first.

### littleEndian

    CONST littleEndian

> Read/write least significant byte first.

### nativeEndian

    CONST nativeEndian

> Do whatever the host machine uses.