public abstract class Encoding extends Object implements COSObjectable
Modifier and Type | Field and Description |
---|---|
protected Map<Integer,String> |
codeToName
This is a mapping from a character code to a character name.
|
protected Map<String,Integer> |
nameToCode
This is a mapping from a character name to a character code.
|
static String |
NOTDEF
Identifies a non-mapped character.
|
Constructor and Description |
---|
Encoding() |
Modifier and Type | Method and Description |
---|---|
void |
addCharacterEncoding(int code,
String name)
This will add a character encoding.
|
String |
getCharacter(int code)
This will get the character from the code.
|
String |
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 |
getCode(String name)
This will get the character code for the name.
|
Map<Integer,String> |
getCodeToNameMap()
Returns an unmodifiable view of the Code2Name mapping.
|
String |
getName(int code)
This will take a character code and get the name from the code.
|
String |
getNameFromCharacter(char c)
This will take a character code and get the name from the code.
|
Map<String,Integer> |
getNameToCodeMap()
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCOSObject
public static final String NOTDEF
protected final Map<Integer,String> codeToName
public Map<Integer,String> getCodeToNameMap()
public Map<String,Integer> getNameToCodeMap()
public void addCharacterEncoding(int code, String name)
code
- The character code that matches the character.name
- The name of the character.public boolean hasCodeForName(String name)
name
- the source value for the mappingpublic boolean hasNameForCode(int code)
code
- the source value for the mappingpublic int getCode(String name) throws IOException
name
- The name of the character.IOException
- If there is no character code for the name.public String getName(int code) throws IOException
code
- The character code.IOException
- If there is no name for the code.public static String getCharacterForName(String name)
name
- The name.public String getNameFromCharacter(char c) throws IOException
c
- The character.IOException
- If there is no name for the character.public String getCharacter(int code) throws IOException
code
- The character code.IOException
- If there is not name for the character.Copyright © 2002-2015 The Apache Software Foundation. All Rights Reserved.