Package org.apache.pdfbox.encoding
Class Encoding
java.lang.Object
org.apache.pdfbox.encoding.Encoding
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
AFMEncoding
,DictionaryEncoding
,MacRomanEncoding
,PdfDocEncoding
,StandardEncoding
,Type1Encoding
,WinAnsiEncoding
This is an interface to a text encoder.
- Version:
- $Revision: 1.15 $
- Author:
- Ben Litchfield
-
Field Summary
FieldsModifier and TypeFieldDescriptionThis is a mapping from a character code to a character name.This is a mapping from a character name to a character code.static final String
Identifies a non-mapped character. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCharacterEncoding
(int code, String name) This will add a character encoding.getCharacter
(int code) This will get the character from the code.getCharacter
(String name) This will get the character from the name.static String
getCharacterForName
(String name) This will take a name and get the character code for that name.int
This will get the character code for the name.Returns an unmodifiable view of the Code2Name mapping.getName
(int code) This will take a character code and get the name from the code.getNameFromCharacter
(char c) This will take a character code and get the name from the code.Returns an unmodifiable view of the Name2Code mapping.boolean
hasCodeForName
(String name) Determines if the encoding has a mapping for the given name value.boolean
hasNameForCode
(int code) Determines if the encoding has a mapping for the given code value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.pdfbox.pdmodel.common.COSObjectable
getCOSObject
-
Field Details
-
NOTDEF
Identifies a non-mapped character.- See Also:
-
codeToName
This is a mapping from a character code to a character name. -
nameToCode
This is a mapping from a character name to a character code.
-
-
Constructor Details
-
Encoding
public Encoding()
-
-
Method Details
-
getCodeToNameMap
Returns an unmodifiable view of the Code2Name mapping.- Returns:
- the Code2Name map
-
getNameToCodeMap
Returns an unmodifiable view of the Name2Code mapping.- Returns:
- the Name2Code map
-
addCharacterEncoding
This will add a character encoding.- Parameters:
code
- The character code that matches the character.name
- The name of the character.
-
hasCodeForName
Determines if the encoding has a mapping for the given name value.- Parameters:
name
- the source value for the mapping- Returns:
- the mapped value
-
hasNameForCode
public boolean hasNameForCode(int code) Determines if the encoding has a mapping for the given code value.- Parameters:
code
- the source value for the mapping- Returns:
- the mapped value
-
getCode
This will get the character code for the name.- Parameters:
name
- The name of the character.- Returns:
- The code for the character.
- Throws:
IOException
- If there is no character code for the name.
-
getName
This will take a character code and get the name from the code.- Parameters:
code
- The character code.- Returns:
- The name of the character.
- Throws:
IOException
- If there is no name for the code.
-
getCharacterForName
This will take a name and get the character code for that name.- Parameters:
name
- The name.- Returns:
- The name of the character.
-
getNameFromCharacter
This will take a character code and get the name from the code.- Parameters:
c
- The character.- Returns:
- The name of the character.
- Throws:
IOException
- If there is no name for the character.
-
getCharacter
This will get the character from the code.- Parameters:
code
- The character code.- Returns:
- The printable character for the code.
- Throws:
IOException
- If there is not name for the character.
-
getCharacter
This will get the character from the name.- Parameters:
name
- The name of the character.- Returns:
- The printable character for the code.
-