dev@fi.java.net

Encoding algorithm support implemented

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 18 Feb 2005 14:25:55 +0100

Hi,

I have implemented the first stage in encoding algorithm support for the
SAX serializer and parser.

The second stage is to allow the registration of application-defined
encoding algorithms and to complete all the built-in algorithms.


For the SAX serializer one can use all of the following:

- the PrimitiveContentHandler methods for bytes, ints and floats
   corresponding to built-in.

- the EncodingAlgorithmContentHandler.octets method for
   application-defined and built-in when the bytes from
   the algorithm are passed (i.e. the application performs
   the encoding);

- the EncodingAlgorithmContentHandler.object method for
   built-in. It is expected that the type passed is an appopriate
   instance according to the built-in type e.g. int[] for the int
   built-in algorithm.; and

- the EncodingAlgorithmAttributes class for built-in and
   application-defined on attribute values. Currently only byte[] is
   supported for application-defined. For built-it it is expected that
   the type passed is an appopriate instance according to the built-in
   type e.g. int[] for the int built-in algorithm.


For the SAX parser one can use either of the following for text content:

- a registered PrimitiveContentHandler for reporting on arrays
   of primitives; or

- a registered EncodingAlgorithmContentHandler for the reporting
   of built-in using the object method, and the reporting of
   application-defined as bytes using the octets methods (i.e. the
   application performs the decoding).

for attributes:

- built-in are reported as objects according to their primitive type.

- application defined are reported an array of bytes.


If both handlers are registered then the parser currently will not
support application-defined for text content and attributes.

I am not entirely happy with the many different routes for the reporting
of algorithm data when parsing. We need to come up with a clearer process.

I will enumerate all possible routes for serializers and parsers and
default behaviour according to registered handlers.


Alan, i think this should be enough for you to start using. I recommend
that for parsing you just use the EncodingAlgorithmContentHandler.

Paul.

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