Package com.sun.pdfview
Class PDFDocCharsetEncoder
java.lang.Object
java.nio.charset.CharsetEncoder
com.sun.pdfview.PDFDocCharsetEncoder
Encodes into a PDFDocEncoding representation. Note that only 256 characters
(if that) are represented in the PDFDocEncoding, so users should be
prepared to deal with unmappable character exceptions.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionFor non-identity encoded characters, maps from the character to the byte value in PDFDocEncoding.(package private) static final boolean[]
For each character that exists in PDFDocEncoding, identifies whether the byte value in UTF-16BE is the same as it is in PDFDocEncoding -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CoderResult
encodeLoop
(CharBuffer in, ByteBuffer out) static boolean
isIdentityEncoding
(char ch) Identify whether a particular character preserves the same byte value upon encoding in PDFDocEncodingboolean
isLegalReplacement
(byte[] repl) Methods inherited from class java.nio.charset.CharsetEncoder
averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implFlush, implOnMalformedInput, implOnUnmappableCharacter, implReplaceWith, implReset, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
-
Field Details
-
IDENT_PDF_DOC_ENCODING_MAP
static final boolean[] IDENT_PDF_DOC_ENCODING_MAPFor each character that exists in PDFDocEncoding, identifies whether the byte value in UTF-16BE is the same as it is in PDFDocEncoding -
EXTENDED_TO_PDF_DOC_ENCODING_MAP
For non-identity encoded characters, maps from the character to the byte value in PDFDocEncoding. If an entry for a non-identity coded character is absent from this map, that character is unmappable in the PDFDocEncoding.
-
-
Constructor Details
-
PDFDocCharsetEncoder
public PDFDocCharsetEncoder()
-
-
Method Details
-
isIdentityEncoding
public static boolean isIdentityEncoding(char ch) Identify whether a particular character preserves the same byte value upon encoding in PDFDocEncoding- Parameters:
ch
- the character- Returns:
- whether the character is identity encoded
-
encodeLoop
- Specified by:
encodeLoop
in classCharsetEncoder
-
isLegalReplacement
public boolean isLegalReplacement(byte[] repl) - Overrides:
isLegalReplacement
in classCharsetEncoder
-