Designing Custom Encoders

encodeToBytes() Method

The encodeToBytes() method requires conversion to produce bytes after encoding from a string field. Following serialization, this method also requires conversion to produce an output (in bytes) having a different format from that used by the parser. If the same format is desired, then the output charset is left undefined, the serializing charset property is substituted by default, and the double conversion is bypassed. The encodeToBytes() process uses both the serializing charset and the output charset, as illustrated in the following figure.

Figure 26 encodeToBytes()

Figure described in content.