Package com.sun.pdfview
Class PDFDocCharsetEncoder
- java.lang.Object
-
- java.nio.charset.CharsetEncoder
-
- com.sun.pdfview.PDFDocCharsetEncoder
-
public class PDFDocCharsetEncoder extends java.nio.charset.CharsetEncoder
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:
- "PDF Reference version 1.7, Appendix D"
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.Map<java.lang.Character,java.lang.Byte>
EXTENDED_TO_PDF_DOC_ENCODING_MAP
For non-identity encoded characters, maps from the character to the byte value in PDFDocEncoding.(package private) static boolean[]
IDENT_PDF_DOC_ENCODING_MAP
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 Constructor Description PDFDocCharsetEncoder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.charset.CoderResult
encodeLoop(java.nio.CharBuffer in, java.nio.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 Detail
-
IDENT_PDF_DOC_ENCODING_MAP
static final boolean[] IDENT_PDF_DOC_ENCODING_MAP
For 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
static final java.util.Map<java.lang.Character,java.lang.Byte> 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.
-
-
Method Detail
-
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
protected java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer in, java.nio.ByteBuffer out)
- Specified by:
encodeLoop
in classjava.nio.charset.CharsetEncoder
-
isLegalReplacement
public boolean isLegalReplacement(byte[] repl)
- Overrides:
isLegalReplacement
in classjava.nio.charset.CharsetEncoder
-
-