Codec 2.0 Migration
Gary Gregory - ggregory@apache.org
Before the release, the package name MAY change from .codec to .codec2.
The interface changes are source compatible.
The interface changes are binary compatible unless call
sites rely on the exact type hierarchy, for example if the client relies on the
StringEncoder directly subclassing
Encoder.
The following interfaces now support generics and may generate compiler warnings:
· Decoder<I, O>
·
Encoder<I, O>
This version adds interfaces that respectively subclass each
of the above:
·
SymmetricDecoder<T>
extends Decoder<T, T>
·
SymmetricEncoder<T>
extends Encoder<T, T>
The following interfaces now subclass their respective
symmetric interfaces:
·
StringEncoder<String,
String>
·
StringDecoder<String,
String>
·
BinaryEncoder< byte[],
byte[]>
· BinaryDecoder< byte[], byte[]>
BinaryCodec
is now abstract and you must replace it with one of its subclasses: BinaryByteCodec
or BinaryCharCodec.
Option: We could leave this class concrete.
Hex is now abstract
and you must replace it with one of its subclasses: HexByteCodec or HexCharCodec. Option:
We could leave this class concrete.
QuotedPrintableCodec
is now abstract and you must replace it with one of its subclasses: QuotedPrintableBinaryCodec
or QuotedPrintableCharCodec.
Option: We could leave this class concrete.
URLCodec is now abstract and you must replace it with one of its subclasses: URLByteCodec or URLCharCodec. Option: We could leave this class concrete.
The abstract class names are not prefixed with Abstract for less ugly code that use static method.
We should move these static methods to their proper
subclasses, further breaking compatibility.
The Encoder and Decoder interfaces now implement generics. This means that there no longer is encode and decode methods that take and return Objects. Call sites must use the proper type, like String, char[], or byte[].