COSObjectable
AFMEncoding
, DictionaryEncoding
, MacRomanEncoding
, PdfDocEncoding
, StandardEncoding
, Type1Encoding
, WinAnsiEncoding
public abstract class Encoding extends java.lang.Object implements COSObjectable
Modifier and Type | Field | Description |
---|---|---|
protected java.util.Map<java.lang.Integer,java.lang.String> |
codeToName |
This is a mapping from a character code to a character name.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
nameToCode |
This is a mapping from a character name to a character code.
|
static java.lang.String |
NOTDEF |
Identifies a non-mapped character.
|
Constructor | Description |
---|---|
Encoding() |
Modifier and Type | Method | Description |
---|---|---|
void |
addCharacterEncoding(int code,
java.lang.String name) |
This will add a character encoding.
|
java.lang.String |
getCharacter(int code) |
This will get the character from the code.
|
java.lang.String |
getCharacter(java.lang.String name) |
This will get the character from the name.
|
static java.lang.String |
getCharacterForName(java.lang.String name) |
This will take a name and get the character code for that name.
|
int |
getCode(java.lang.String name) |
This will get the character code for the name.
|
java.util.Map<java.lang.Integer,java.lang.String> |
getCodeToNameMap() |
Returns an unmodifiable view of the Code2Name mapping.
|
java.lang.String |
getName(int code) |
This will take a character code and get the name from the code.
|
java.lang.String |
getNameFromCharacter(char c) |
This will take a character code and get the name from the code.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getNameToCodeMap() |
Returns an unmodifiable view of the Name2Code mapping.
|
boolean |
hasCodeForName(java.lang.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.
|
getCOSObject
public static final java.lang.String NOTDEF
protected final java.util.Map<java.lang.Integer,java.lang.String> codeToName
protected final java.util.Map<java.lang.String,java.lang.Integer> nameToCode
public java.util.Map<java.lang.Integer,java.lang.String> getCodeToNameMap()
public java.util.Map<java.lang.String,java.lang.Integer> getNameToCodeMap()
public void addCharacterEncoding(int code, java.lang.String name)
code
- The character code that matches the character.name
- The name of the character.public boolean hasCodeForName(java.lang.String name)
name
- the source value for the mappingpublic boolean hasNameForCode(int code)
code
- the source value for the mappingpublic int getCode(java.lang.String name) throws java.io.IOException
name
- The name of the character.java.io.IOException
- If there is no character code for the name.public java.lang.String getName(int code) throws java.io.IOException
code
- The character code.java.io.IOException
- If there is no name for the code.public static java.lang.String getCharacterForName(java.lang.String name)
name
- The name.public java.lang.String getNameFromCharacter(char c) throws java.io.IOException
c
- The character.java.io.IOException
- If there is no name for the character.public java.lang.String getCharacter(int code) throws java.io.IOException
code
- The character code.java.io.IOException
- If there is not name for the character.public java.lang.String getCharacter(java.lang.String name)
name
- The name of the character.