Package org.apache.fop.afp.fonts
Class CharactersetEncoder
java.lang.Object
org.apache.fop.afp.fonts.CharactersetEncoder
- Direct Known Subclasses:
CharactersetEncoder.DefaultEncoder
,CharactersetEncoder.EbcdicDoubleByteLineDataEncoder
An abstraction that wraps the encoding mechanism for encoding a Unicode character sequence into a
specified format.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
The default encoder is used for encoding IBM format SBCS (single byte character sets), this the primary format for most Latin character sets.(package private) static final class
The EBCDIC double byte encoder is used for encoding IBM format DBCS (double byte character sets) with an EBCDIC code-page.static class
A container for encoded character bytes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final boolean
canEncode
(char c) Tells whether or not this encoder can encode the given character.(package private) final CharactersetEncoder.EncodedChars
encode
(CharSequence chars) Encodes a character sequence to a byte array.encodeSBCS
(CharSequence chars, String encoding) Encodeschars
into a format specified byencoding
.(package private) abstract CharactersetEncoder.EncodedChars
getEncodedChars
(byte[] byteArray, int length)
-
Field Details
-
encoder
-
-
Constructor Details
-
CharactersetEncoder
-
-
Method Details
-
canEncode
final boolean canEncode(char c) Tells whether or not this encoder can encode the given character.- Parameters:
c
- the character- Returns:
- true if, and only if, this encoder can encode the given character
- Throws:
IllegalStateException
- - If an encoding operation is already in progress
-
encode
Encodes a character sequence to a byte array.- Parameters:
chars
- the character sequence- Returns:
- the encoded character sequence
- Throws:
CharacterCodingException
- if the encoding operation fails
-
getEncodedChars
-
encodeSBCS
public static CharactersetEncoder.EncodedChars encodeSBCS(CharSequence chars, String encoding) throws CharacterCodingException Encodeschars
into a format specified byencoding
.- Parameters:
chars
- the character sequenceencoding
- the encoding type- Returns:
- encoded data
- Throws:
CharacterCodingException
- if encoding fails
-