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

# Codec:YEnc

### Import List

        ADT:StringBuffer
        Codec
        Object
        RT0

Class List
Decoder |
Encoder |
YEnc |

Class Summary: Decoder [Detail]
      +---Codec.Decoder
           |
           +--Codec:YEnc.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.
INIT()
Reset() Resets the decoder's state to that created by the initial dec.Start.
Inherited Methods
From Codec.Decoder: Decode, End, INIT, Reset, Start

Class Summary: Encoder [Detail]
      +---Codec.Encoder
           |
           +--Codec:YEnc.Encoder
Method Summary
Closure(StringBuffer) If the encoder still holds any partial data from previous calls to enc.Encode, then flush this data to the buffer b.
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.
INIT()
Reset() Resets the encoder's state to that created by the initial enc.Start.
Inherited Methods
From Codec.Encoder: Closure, Encode, EncodeLatin1, EncodeUTF16, End, INIT, Reset, SetEscapeEncoder, Start

Class Summary: YEnc [Detail]
      +---RT0.Object
           |
           +---Object.Object
                |
                +---Codec.Codec
                     |
                     +--Codec:YEnc.YEnc
Inherited Fields
From Codec.Codec: class, preferredName
Method Summary
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

Type Summary
Header = RECORD ... END

Procedure Summary
IsEOL(CHAR): BOOLEAN
LineBegin(ARRAY OF CHAR, LONGINT, LONGINT, VAR Header): LONGINT If the text starting a ``data[start]`' holds a valid ``begin`' of a yencoded file, then return the index of the first eol character of the ``begin`' line.
LineData(ARRAY OF CHAR, LONGINT, LONGINT, VAR Header): LONGINT If the text starting a ``data[start]`' holds a complete text line with yencoded data, then return the index of the first eol character of the line.
LineEnd(ARRAY OF CHAR, LONGINT, LONGINT, VAR Header): LONGINT If the text starting a ``data[start]`' holds a valid ``end`' of a uuencode file, then return the index of the first eol character of the ``begin`' line.
LinePart(ARRAY OF CHAR, LONGINT, LONGINT, VAR Header): LONGINT
Register()

Variable Summary
yenc-: YEnc

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

### INIT

    PROCEDURE (dec: Decoder) INIT()

> Redefines: INIT

### Reset

    PROCEDURE (dec: Decoder) Reset()

> Resets the decoder's state to that created by the initial dec.Start. All allocated resources are kept. Using this method, it is possible to use one and the same decoder for several different data streams.

> [Description inherited from Reset]

> Redefines: Reset

Class Detail: Encoder

Method Detail

### Closure

    PROCEDURE (enc: Encoder) Closure(b: StringBuffer)

> If the encoder still holds any partial data from previous calls to enc.Encode, then flush this data to the buffer b. This method must be called at the end of the data stream for codecs that operate on blocks of data, and for which the last and possibly incomplete block must be handled specially.

> [Description inherited from Closure]

> Redefines: Closure

### EncodeLatin1

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

> 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)

> 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

### INIT

    PROCEDURE (enc: Encoder) INIT()

> Redefines: INIT

### Reset

    PROCEDURE (enc: Encoder) Reset()

> Resets the encoder's state to that created by the initial enc.Start. All allocated resources are kept. Using this method, it is possible to use one and the same encoder for several different data streams.

> [Description inherited from Reset]

> Redefines: Reset

Class Detail: YEnc

Method Detail

### NewDecoder

    PROCEDURE (c: YEnc) 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: YEnc) 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

Type Detail

### Header

    TYPE Header = RECORD
                      part-: LONGINT;
                      line-: LONGINT;
                      size-: LONGINT;
                      fileName-: ARRAY n OF CHAR;
                      partBegin-: LONGINT;
                      partEnd-: LONGINT;
                      endSize-: LONGINT;
                      endPart-: LONGINT;
                      hasPCrc32-: BOOLEAN;
                      endPCrc32-: LONGINT;
                      hasCrc32-: BOOLEAN;
                      endCrc32-: LONGINT;
                      shortLines-: LONGINT;
                  END

Procedure Detail

### IsEOL

    PROCEDURE IsEOL(ch: CHAR): BOOLEAN

### LineBegin

    PROCEDURE LineBegin(data: ARRAY OF CHAR;
                        start: LONGINT;
                        end: LONGINT;
                        VAR header: Header): LONGINT

> If the text starting a ``data[start]`' holds a valid ``begin`' of a yencoded file, then return the index of the first eol character of the ``begin`' line. In this case, ``data[start, result-1]`' is the complete line, without the eol character that ends it.

> If there is no match, then result ``-1`'. If the indicated region of data holds no end of line character, then no match is possible.

### LineData

    PROCEDURE LineData(data: ARRAY OF CHAR;
                       start: LONGINT;
                       end: LONGINT;
                       VAR header: Header): LONGINT

> If the text starting a ``data[start]`' holds a complete text line with yencoded data, then return the index of the first eol character of the line. In this case, ``data[start, result-1]`' is the complete line, without the eol character that ends it.

> If there is no match, then result ``-1`'. If the indicated region of data holds no end of line character, then no match is possible.

> If the data line is shorted than the announced line length in the ``=ybegin`' header, then header.shortLines is incremented by one.

### LineEnd

    PROCEDURE LineEnd(data: ARRAY OF CHAR;
                      start: LONGINT;
                      end: LONGINT;
                      VAR header: Header): LONGINT

> If the text starting a ``data[start]`' holds a valid ``end`' of a uuencode file, then return the index of the first eol character of the ``begin`' line. In this case, ``data[start, result-1]`' is the complete line, without the eol character that ends it.

> If there is no match, then result ``-1`'. If the indicated region of data holds no end of line character, then no match is possible.

### LinePart

    PROCEDURE LinePart(data: ARRAY OF CHAR;
                       start: LONGINT;
                       end: LONGINT;
                       VAR header: Header): LONGINT

### Register

    PROCEDURE Register()

Variable Detail

### yenc

    VAR yenc-: YEnc