Package org.apache.fop.afp.fonts
Class CharactersetEncoder
- java.lang.Object
-
- org.apache.fop.afp.fonts.CharactersetEncoder
-
- Direct Known Subclasses:
CharactersetEncoder.DefaultEncoder,CharactersetEncoder.EbcdicDoubleByteLineDataEncoder
public abstract class CharactersetEncoder extends java.lang.ObjectAn abstraction that wraps the encoding mechanism for encoding a Unicode character sequence into a specified format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classCharactersetEncoder.DefaultEncoderThe 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 classCharactersetEncoder.EbcdicDoubleByteLineDataEncoderThe EBCDIC double byte encoder is used for encoding IBM format DBCS (double byte character sets) with an EBCDIC code-page.static classCharactersetEncoder.EncodedCharsA container for encoded character bytes
-
Field Summary
Fields Modifier and Type Field Description private java.nio.charset.CharsetEncoderencoder
-
Constructor Summary
Constructors Modifier Constructor Description privateCharactersetEncoder(java.lang.String encoding)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) booleancanEncode(char c)Tells whether or not this encoder can encode the given character.(package private) CharactersetEncoder.EncodedCharsencode(java.lang.CharSequence chars)Encodes a character sequence to a byte array.static CharactersetEncoder.EncodedCharsencodeSBCS(java.lang.CharSequence chars, java.lang.String encoding)Encodescharsinto a format specified byencoding.(package private) abstract CharactersetEncoder.EncodedCharsgetEncodedChars(byte[] byteArray, int length)
-
-
-
Method Detail
-
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:
java.lang.IllegalStateException- - If an encoding operation is already in progress
-
encode
final CharactersetEncoder.EncodedChars encode(java.lang.CharSequence chars) throws java.nio.charset.CharacterCodingException
Encodes a character sequence to a byte array.- Parameters:
chars- the character sequence- Returns:
- the encoded character sequence
- Throws:
java.nio.charset.CharacterCodingException- if the encoding operation fails
-
getEncodedChars
abstract CharactersetEncoder.EncodedChars getEncodedChars(byte[] byteArray, int length)
-
encodeSBCS
public static CharactersetEncoder.EncodedChars encodeSBCS(java.lang.CharSequence chars, java.lang.String encoding) throws java.nio.charset.CharacterCodingException
Encodescharsinto a format specified byencoding.- Parameters:
chars- the character sequenceencoding- the encoding type- Returns:
- encoded data
- Throws:
java.nio.charset.CharacterCodingException- if encoding fails
-
-