dev@fi.java.net

Re: Encoding algorithms

From: Santiago Pericas-Geertsen <Santiago.Pericasgeertsen_at_Sun.COM>
Date: Thu, 10 Feb 2005 08:34:12 -0500

Hi Paul,

  Would it make sense to define specific methods for the built-in
algorithms? I'm a bit worried about the unnecessary boxing/unboxing of
returning/taking Object instances. Also, the methods that take streams
may be useful too.

-- Santiago

On Feb 9, 2005, at 11:08 AM, Paul Sandoz wrote:

> 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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_fi.dev.java.net
> For additional commands, e-mail: dev-help_at_fi.dev.java.net
>