lejos.charset
Interface CharsetEncoder
- All Known Implementing Classes:
- Latin1Encoder, UTF8Encoder
public interface CharsetEncoder
Method Summary |
int |
encode(int codepoint,
byte[] target,
int offset)
Writes the encoding of the codepoint to the byte-array. |
int |
estimateByteCount(int codepoint)
Return the number of bytes needed to encode the given codepoint. |
int |
getMaxCharLength()
|
getMaxCharLength
int getMaxCharLength()
encode
int encode(int codepoint,
byte[] target,
int offset)
- Writes the encoding of the codepoint to the byte-array.
The codepoint may be -1 to indicate an undecodable codepoint.
- Parameters:
codepoint
- the character to encodetarget
- target byte arrayoffset
- index of first byte
- Returns:
- the offset for the next character
estimateByteCount
int estimateByteCount(int codepoint)
- Return the number of bytes needed to encode the given codepoint.
The value returned must not be an underestimation.
- Parameters:
codepoint
- the Unicode codepoint
- Returns:
- the estimated number of bytes