Package com.itextpdf.io.font.cmap
Class CMapContentParser
- java.lang.Object
-
- com.itextpdf.io.font.cmap.CMapContentParser
-
public class CMapContentParser extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMMAND_TYPE
Commands have this type.private PdfTokenizer
tokeniser
Holds value of property tokeniser.
-
Constructor Summary
Constructors Constructor Description CMapContentParser(PdfTokenizer tokeniser)
Creates a new instance of PdfContentParser
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.String
decodeCMapObject(CMapObject cMapObject)
protected static java.lang.String
decodeName(byte[] content)
Deprecated.boolean
nextValidToken()
Reads the next token skipping over the comments.void
parse(java.util.List<CMapObject> ls)
Parses a single command from the content.CMapObject
readArray()
Reads an array.CMapObject
readDictionary()
Reads a dictionary.CMapObject
readObject()
Reads a pdf object.static java.lang.String
toHex(int n)
Gets an hex string in the format "<HHHH>".private static java.lang.String
toHex4(int n)
-
-
-
Field Detail
-
COMMAND_TYPE
public static final int COMMAND_TYPE
Commands have this type.- See Also:
- Constant Field Values
-
tokeniser
private PdfTokenizer tokeniser
Holds value of property tokeniser.
-
-
Constructor Detail
-
CMapContentParser
public CMapContentParser(PdfTokenizer tokeniser)
Creates a new instance of PdfContentParser- Parameters:
tokeniser
- the tokeniser with the content
-
-
Method Detail
-
parse
public void parse(java.util.List<CMapObject> ls) throws java.io.IOException
Parses a single command from the content. Each command is output as an array of arguments having the command itself as the last element. The returned array will be empty if the end of content was reached.- Parameters:
ls
- anArrayList
to use. It will be cleared before using.- Throws:
java.io.IOException
- on error
-
readDictionary
public CMapObject readDictionary() throws java.io.IOException
Reads a dictionary. The tokeniser must be positioned past the"<<"
token.- Returns:
- the dictionary
- Throws:
java.io.IOException
- on error
-
readArray
public CMapObject readArray() throws java.io.IOException
Reads an array. The tokeniser must be positioned past the "[" token.- Returns:
- an array
- Throws:
java.io.IOException
- on error
-
readObject
public CMapObject readObject() throws java.io.IOException
Reads a pdf object.- Returns:
- the pdf object
- Throws:
java.io.IOException
- on error
-
nextValidToken
public boolean nextValidToken() throws java.io.IOException
Reads the next token skipping over the comments.- Returns:
true
if a token was read,false
if the end of content was reached.- Throws:
java.io.IOException
- on error.
-
decodeName
@Deprecated protected static java.lang.String decodeName(byte[] content)
Deprecated.UsePdfNameUtil.decodeName(byte[])
instead.- Parameters:
content
- to decode- Returns:
- decoded content
-
toHex4
private static java.lang.String toHex4(int n)
-
toHex
public static java.lang.String toHex(int n)
Gets an hex string in the format "<HHHH>".- Parameters:
n
- the number- Returns:
- the hex string
-
decodeCMapObject
public static java.lang.String decodeCMapObject(CMapObject cMapObject)
-
-