Coder is a class that takes data from dynamic memory and codes them into and out of some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads).Instances of Coder are referred to as coder objects, or simply coders.
Coder operates on objects, scalars, and Java arrays. A coder object stores object type information along with the data, so an object decoded from a stream of bytes is normally of the same class as the object that was originally encoded into the stream.
To encode an object or data item, use any of the encode... methods.
In order for a coder to restore an object, the object must provide a constructor that takes a coder as its argument, as in the following:
public MyCodingClass(next.util.Coder coder)
This constructor would use the various decode... methods provided by this class to populate instance variables. These decode... methods must correspond to the original encode... methods (as given in the individual method descriptions). Matching these is important, as the method originally used determines the format of the encoded data. See the Coding interface specification for more information.
Coder's interface is quite general. Concrete subclasses aren't required to properly implement all of Coder's methods, and may explicitly restrict themselves to certain types of operations.