|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.PdfEncodings
public class PdfEncodings
Supports fast encodings for winansi and PDFDocEncoding. Supports conversions from CJK encodings to CID. Supports custom encodings.
Nested Class Summary | |
---|---|
private static class |
PdfEncodings.Cp437Conversion
|
private static class |
PdfEncodings.SymbolConversion
|
private static class |
PdfEncodings.SymbolTTConversion
|
private static class |
PdfEncodings.WingdingsConversion
|
Field Summary | |
---|---|
protected static int |
CIDCHAR
|
protected static int |
CIDNONE
|
protected static int |
CIDRANGE
|
(package private) static HashMap |
cmaps
|
static byte[][] |
CRLF_CID_NEWLINE
Assumes that '\\n' and '\\r\\n' are the newline sequences. |
(package private) static HashMap |
extraEncodings
|
(package private) static IntHashtable |
pdfEncoding
|
(package private) static char[] |
pdfEncodingByteToChar
|
(package private) static IntHashtable |
winansi
|
(package private) static char[] |
winansiByteToChar
|
Constructor Summary | |
---|---|
PdfEncodings()
|
Method Summary | |
---|---|
static void |
addExtraEncoding(String name,
ExtraEncoding enc)
Adds an extra encoding. |
(package private) static void |
breakLong(long n,
int size,
byte[] seqs)
|
static void |
clearCmap(String name)
Clears the CJK cmaps from the cache. |
static String |
convertCmap(String name,
byte[] seq)
Converts a byte array encoded as name
to a CID string. |
static String |
convertCmap(String name,
byte[] seq,
int start,
int length)
Converts a byte array encoded as name
to a CID string. |
static byte[] |
convertToBytes(char char1,
String encoding)
Converts a String to a byte array according
to the font's encoding. |
static byte[] |
convertToBytes(String text,
String encoding)
Converts a String to a byte array according
to the font's encoding. |
static String |
convertToString(byte[] bytes,
String encoding)
Converts a byte array to a String according
to the some encoding. |
(package private) static String |
decodeSequence(byte[] seq,
int start,
int length,
char[][] planes)
|
(package private) static void |
encodeSequence(int size,
byte[] seqs,
char cid,
ArrayList planes)
|
(package private) static void |
encodeStream(InputStream in,
ArrayList planes)
|
static boolean |
isPdfDocEncoding(String text)
Checks is text only has PdfDocEncoding characters. |
static void |
loadCmap(String name,
byte[][] newline)
Loads a CJK cmap to the cache with the option of associating sequences to the newline. |
(package private) static void |
readCmap(String name,
ArrayList planes)
|
(package private) static char[][] |
readCmap(String name,
byte[][] newline)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int CIDNONE
protected static final int CIDRANGE
protected static final int CIDCHAR
static final char[] winansiByteToChar
static final char[] pdfEncodingByteToChar
static final IntHashtable winansi
static final IntHashtable pdfEncoding
static HashMap extraEncodings
static final HashMap cmaps
public static final byte[][] CRLF_CID_NEWLINE
Constructor Detail |
---|
public PdfEncodings()
Method Detail |
---|
public static final byte[] convertToBytes(String text, String encoding)
String
to a byte array according
to the font's encoding.
encoding
- the encodingtext
- the String
to be converted
byte
representing the conversion according to the font's encodingpublic static final byte[] convertToBytes(char char1, String encoding)
String
to a byte array according
to the font's encoding.
encoding
- the encodingchar1
- the char
to be converted
byte
representing the conversion according to the font's encodingpublic static final String convertToString(byte[] bytes, String encoding)
String
according
to the some encoding.
bytes
- the bytes to convertencoding
- the encoding
String
public static boolean isPdfDocEncoding(String text)
text
only has PdfDocEncoding characters.
text
- the String
to test
true
if only PdfDocEncoding characters are presentpublic static void clearCmap(String name)
name
is the
empty string then all the cache is cleared. Calling this method
has no consequences other than the need to reload the cmap
if needed.
name
- the name of the cmap to clear or all the cmaps if the empty stringpublic static void loadCmap(String name, byte[][] newline)
name
- the CJK cmap namenewline
- the sequences to be replaced by a newline in the resulting CID. See CRLF_CID_NEWLINE
public static String convertCmap(String name, byte[] seq)
byte
array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
name
- the CJK encoding nameseq
- the byte
array to be decoded
public static String convertCmap(String name, byte[] seq, int start, int length)
byte
array encoded as name
to a CID string. This is needed to reach some CJK characters
that don't exist in 16 bit Unicode.
The font to use this result must use the encoding "Identity-H"
or "Identity-V".
See ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
name
- the CJK encoding namestart
- the start offset in the datalength
- the number of bytes to convertseq
- the byte
array to be decoded
static String decodeSequence(byte[] seq, int start, int length, char[][] planes)
static char[][] readCmap(String name, byte[][] newline) throws IOException
IOException
static void readCmap(String name, ArrayList planes) throws IOException
IOException
static void encodeStream(InputStream in, ArrayList planes) throws IOException
IOException
static void breakLong(long n, int size, byte[] seqs)
static void encodeSequence(int size, byte[] seqs, char cid, ArrayList planes)
public static void addExtraEncoding(String name, ExtraEncoding enc)
name
- the name of the encoding. The encoding recognition is case insensitiveenc
- the conversion class
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |