public interface ICharacterEncoder
| Modifier and Type | Method and Description |
|---|---|
int |
Encode(int c,
IWriter output)
Converts a Unicode code point to bytes and writes the bytes to an output
stream.
|
int Encode(int c,
IWriter output)
If this method returns -2, indicating an error, the caller of this method can take one of a variety of actions to handle the error. For example, it can write an escape sequence using the code point (such as the HTML error mode in the Encoding Standard), it can replace the code point with a "best fit" to that code point (which can consist of one or more bytes) and write the "best fit" instead, it can replace the code point with an arbitrary byte or sequence of bytes, or it can throw an exception. In some cases, where the error won't cause data loss or a security problem, the caller can also ignore the encoding error.
c - Either a Unicode code point (from 0-0xd7ff or from 0xe000 to
0x10ffff), or the value -1 indicating the end of the stream.output - Output stream where the converted bytes will be written. The
decoder can maintain internal state, including data on code points
already passed as input, so this parameter should not change when
using the same character encoder object.Encoding for Java documentation, generated in 2017.