Cramfull Compiled Resources v2.00

be.arci.pub
Class TwoByteEncoder

java.lang.Object
  |
  +--be.arci.cramfull.Encoder
        |
        +--be.arci.pub.TwoByteEncoder

public class TwoByteEncoder
extends Encoder

Example Encoder implementation, that encodes 2 bytes as 1 char.

Encodes a Resource by reading it in as chars, at 2 bytes per char. The evenness of the resource's file length in bytes is encoded in the first char: even length is encoded as '2', uneven length as '1'. If that length is uneven, the file's first byte is encoded alone in the loworder part of the second char.

If you encode resorces using this class, you have to include the TwoByteDecoder class in the distribution of your software.

We supply this class as a free service to all users of the Cramfull Compiled Resources library. You are allowed to modify this source code, provided you move the class out of the be.arci package hierarchy.

Since:
05/nov/2000
See Also:
TwoByteDecoder,
Encoder

Constructor Summary
TwoByteEncoder()
           
 
Method Summary
 void encode(java.io.DataInput di, int iResourceLength)
          Encodes the resource file into a sequence of char-s; implementations must invoke write(char c) for each encoded char.
 java.lang.String getDecoderClassName()
          The Decoder associated with this Encoder is be.arci.pub.TwoByteDecoder
 
Methods inherited from class be.arci.cramfull.Encoder
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoByteEncoder

public TwoByteEncoder()
Method Detail

encode

public void encode(java.io.DataInput di,
                   int iResourceLength)
            throws java.io.IOException
Description copied from class: Encoder
Encodes the resource file into a sequence of char-s; implementations must invoke write(char c) for each encoded char. The Decoder will read this char sequence in the same order.

Overrides:
encode in class Encoder
Tags copied from class: Encoder
Parameters:
di - a DataInput opened on the resource to encode.
iResourceLength - the number of bytes in the di that must be read and encoded.
See Also:
Decoder,
write(char c)

getDecoderClassName

public java.lang.String getDecoderClassName()
The Decoder associated with this Encoder is be.arci.pub.TwoByteDecoder
Overrides:
getDecoderClassName in class Encoder
Returns:
"be.arci.pub.TwoByteDecoder"
See Also:
TwoByteDecoder

Cramfull Compiled Resources v2.00