dev@fi.java.net

Encoding algorithms

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Feb 2005 17:08:58 +0100

Hi,

I have added a preliminary interface for encoding algorithms.

This interface is:

public interface EncodingAlgorithm {

     public Object decodeFromBytes(byte[] b, int start, int length);

     public byte[] encodeToBytes(Object data, byte[] b, int start);

     // These method may also be required for application-defined algorithm
     // void decodeFromInputStream(Object data, InputStream s) throws
IOException;

     // void encodeToOutputStream(Object data, OutputStream s) throws
IOException;

     public Object convertFromCharacters(char[] ch, int start, int length);

     public char[] convertToCharacters(Object data, char ch[], int start);

}

This interface is also designed to be used for application defined
encoding algorithms if we choose to support the registering of such
algorithms with the parser and serializer.

The SAX interface EncodingAlgorithmContentHandler supports the writing
of an Object according to a URI or an id. There can be a mapping from
the URI or id to an EncodingAlgorithm from which an Object can be
encoded to produce bytes or vice versa.

I think i already need to make one modification to the encodeToBytes
method. It is not possible to obtain how many bytes have been written.
We need a simple ByteArray holder class to be returned for this.

Alan, would this meet your requirements for X3D?

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109