org.pdfbox.encoding

Class Encoding

Implemented Interfaces:
COSObjectable
Known Direct Subclasses:
AFMEncoding, DictionaryEncoding, MacRomanEncoding, PdfDocEncoding, StandardEncoding, WinAnsiEncoding

public abstract class Encoding
extends java.lang.Object
implements COSObjectable

This is an interface to a text encoder.
Version:
$Revision: 1.15 $
Author:
Ben Litchfield

Field Summary

protected Map
codeToName
This is a mapping from a character code to a character name.
protected Map
nameToCode
This is a mapping from a character name to a character code.

Method Summary

protected void
addCharacterEncoding(int code, COSName name)
This will add a character encoding.
String
getCharacter(int code)
This will get the character from the code.
static String
getCharacter(COSName name)
This will get the character from the name.
int
getCode(COSName name)
This will get the character code for the name.
COSName
getName(int code)
This will take a character code and get the name from the code.
COSName
getNameFromCharacter(char c)
This will take a character code and get the name from the code.

Field Details

codeToName

protected Map codeToName
This is a mapping from a character code to a character name.

nameToCode

protected Map nameToCode
This is a mapping from a character name to a character code.

Method Details

addCharacterEncoding

protected void addCharacterEncoding(int code,
                                    COSName name)
This will add a character encoding.
Parameters:
code - The character code that matches the character.
name - The name of the character.

getCharacter

public String getCharacter(int code)
            throws IOException
This will get the character from the code.
Parameters:
code - The character code.
Returns:
The printable character for the code.

getCharacter

public static String getCharacter(COSName name)
This will get the character from the name.
Parameters:
name - The name of the character.
Returns:
The printable character for the code.

getCode

public int getCode(COSName name)
            throws IOException
This will get the character code for the name.
Parameters:
name - The name of the character.
Returns:
The code for the character.

getName

public COSName getName(int code)
            throws IOException
This will take a character code and get the name from the code.
Parameters:
code - The character code.
Returns:
The name of the character.

getNameFromCharacter

public COSName getNameFromCharacter(char c)
            throws IOException
This will take a character code and get the name from the code.
Parameters:
c - The character.
Returns:
The name of the character.