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

# Codec:Ascii

### Import List

        ADT:StringBuffer
        Codec
        Object
        RT0

Class List
Ascii |
Decoder |
Encoder |

Class Summary: Ascii [Detail]
      +---RT0.Object
           |
           +---Object.Object
                |
                +---Codec.Codec
                     |
                     +--Codec:Ascii.Ascii
Inherited Fields
From Codec.Codec: class, preferredName
Method Summary
DecodeRegion(ARRAY OF CHAR, LONGINT, LONGINT): STRING Decode the 8-bit character sequence in ``data[start, end-1]`'.
INIT(ARRAY OF CHAR)
NewDecoder(): Decoder Creates a decoder object for the codec c.
NewEncoder(): Encoder Creates an encoder object for the codec c.
Inherited Methods
From RT0.Object: Finalize From Object.Object: Equals, HashCode, ToString From Codec.Codec: Decode, DecodeRegion, Encode, EncodeRegion, INIT, NewDecoder, NewEncoder

Class Summary: Decoder [Detail]
      +---Codec.Decoder
           |
           +--Codec:Ascii.Decoder
Method Summary
Decode(ARRAY OF CHAR, LONGINT, LONGINT, StringBuffer) Decode the 8-bit character sequence in ``data[start, end-1]`' starting with the decoder state dec.
Inherited Methods
From Codec.Decoder: Decode, End, INIT, Reset, Start

Class Summary: Encoder [Detail]
      +---Codec.Encoder
           |
           +--Codec:Ascii.Encoder
Method Summary
EncodeLatin1(ARRAY OF CHAR, LONGINT, LONGINT, StringBuffer) Encode the Latin1 character sequence in ``s[start, end-1]`' starting with the encoder state enc.
EncodeUTF16(ARRAY OF LONGCHAR, LONGINT, LONGINT, StringBuffer) Encode the UTF-16 character sequence in ``s[start, end-1]`' starting with the encoder state enc.
Inherited Methods
From Codec.Encoder: Closure, Encode, EncodeLatin1, EncodeUTF16, End, INIT, Reset, SetEscapeEncoder, Start

Procedure Summary
Register()

Variable Summary
codec-: Ascii

Class Detail: Ascii

Method Detail

### DecodeRegion

    PROCEDURE (c: Ascii) DecodeRegion(data: ARRAY OF CHAR;
                           start: LONGINT;
                           end: LONGINT): STRING

> Decode the 8-bit character sequence in ``data[start, end-1]`'. For succesful completion, the byte sequence ``data[start, end-1]`' must be well formed with respect to the decoder, and the resulting Unicode code points must all be valid.

> Pre-condition: ``0 <= start <= end <= LEN(data)`'.

> [Description inherited from DecodeRegion]

> Redefines: DecodeRegion

### INIT

    PROCEDURE (c: Ascii) INIT(preferredName: ARRAY OF CHAR)

> Redefines: INIT

### NewDecoder

    PROCEDURE (c: Ascii) NewDecoder(): Decoder

> Creates a decoder object for the codec c. Note: Some decoders, like those implementing an decryption algorithm, require additional settings before they can be used.

> [Description inherited from NewDecoder]

> Redefines: NewDecoder

### NewEncoder

    PROCEDURE (c: Ascii) NewEncoder(): Encoder

> Creates an encoder object for the codec c. By default, any character sequences the encoder cannot handle cause it to raise an exception EncodingError.

> Note: Some encoders, like those implementing encryption algorithm, require additional settings before they can be used.

> [Description inherited from NewEncoder]

> Redefines: NewEncoder

Class Detail: Decoder

Method Detail

### Decode

    PROCEDURE (dec: Decoder) Decode(data: ARRAY OF CHAR;
                     start: LONGINT;
                     end: LONGINT;
                     b: StringBuffer)

> Decode the 8-bit character sequence in ``data[start, end-1]`' starting with the decoder state dec. The result is appended to the string buffer b. On completion, dec is updated to reflect the decoder's state after the last byte of the sequence has been processed.

> Pre-condition: ``0 <= start <= end <= LEN(data)`'. dec.Start has been called.

> [Description inherited from Decode]

> Redefines: Decode

Class Detail: Encoder

Method Detail

### EncodeLatin1

    PROCEDURE (enc: Encoder) EncodeLatin1(s: ARRAY OF CHAR;
                           start: LONGINT;
                           end: LONGINT;
                           b: StringBuffer)
      RAISES EncodingError;

> Encode the Latin1 character sequence in ``s[start, end-1]`' starting with the encoder state enc. The result is a string holding only code points in the range ``[U+0000, U+00FF]`', which is appended to the string buffer b. On completion, enc is updated to reflect the encoder's state after the last byte of the sequence has been processed.

> Pre-condition: ``0 <= start <= end <= s.length`'. enc.Start has been called. All code points in ``data[start, end-1]`' are valid. That is, neither is out of range nor from the surrogate areas.

> [Description inherited from EncodeLatin1]

> Redefines: EncodeLatin1

### EncodeUTF16

    PROCEDURE (enc: Encoder) EncodeUTF16(s: ARRAY OF LONGCHAR;
                          start: LONGINT;
                          end: LONGINT;
                          b: StringBuffer)
      RAISES EncodingError;

> Encode the UTF-16 character sequence in ``s[start, end-1]`' starting with the encoder state enc. The result is a string holding only code points in the range ``[U+0000, U+00FF]`', which is appended to the string buffer b. On completion, enc is updated to reflect the encoder's state after the last byte of the sequence has been processed.

> Pre-condition: ``0 <= start <= end <= s.length`'. enc.Start has been called. All code points in ``data[start, end-1]`' are valid. That is, neither is out of range nor from the surrogate areas.

> [Description inherited from EncodeUTF16]

> Redefines: EncodeUTF16

Procedure Detail

### Register

    PROCEDURE Register()

Variable Detail

### codec

    VAR codec-: Ascii