Cramfull Compiled Resources v2.00

Class Decoder

Direct Known Subclasses:
ASCIIDecoder, CharDecoder, TwoByteDecoder

public abstract class Decoder
extends java.lang.Object

Decodes resources that are encoded into a Cramfull subclass. The method byte[] decode(int iEncodedLength) is invoked on the implementing subclass, which has access to the method int read() to read the encoded char sequence.

IMPORTANT: Subclasses should be public and either have no constructor declaration or have a public constructor that takes no arguments. Example implementations are given in the package

See Also:
decode(int iEncodedLength),

Constructor Summary
Method Summary
abstract  byte[] decode(int iEncodedLength)
          Decodes a resource from a sequence of char-s.
protected  int read()
          Reads the next char from the internal form of the encoded resource.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Decoder()
Method Detail


public abstract byte[] decode(int iEncodedLength)
                       throws ResourceDecodingException
Decodes a resource from a sequence of char-s. This is the reverse process of the corresponding Encoder's void encode(DataInput di, int iResourceLength). Implementations must invoke the method int read() to retrieve the encoded char-s of the resource.

iEncodedLength - the length in char-s of the encoded form of the resource
the bytes of the decoded resource, as they were read in by the ClassCompiler from the original resource file. If a decoding error occurs, the implementing subclass has the choice of either returning the value null, or throwing a ResourceDecodingException giving more detailed info on the decoding error.
ResourceDecodingException - if a decoding error occurs and the implementing subclass wants to give a more detailed message about the decoding error.
See Also:
Encoder.encode(DataInput di, int iResourceLength),


protected final int read()
Reads the next char from the internal form of the encoded resource. Chars are read in the same sequence as they were written by the Encoder subclass corresponding to this Decoder subclass.
the next char of the encoded resource, -1 on EOF

Cramfull Compiled Resources v2.00