Package com.itextpdf.text.pdf
Class PRTokeniser
java.lang.Object
com.itextpdf.text.pdf.PRTokeniser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum representing the possible token types -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean[](package private) static final Stringprivate final RandomAccessFileOrArrayprotected intprotected booleanprivate final StringBuilderprotected intprotected Stringprotected PRTokeniser.TokenType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbackOnePosition(int ch) voidstatic long[]checkObjectStart(byte[] line) charvoidclose()getFile()longintintstatic intgetHex(int v) intGets current reference number.longintintValue()static final booleanisDelimiter(int ch) static final booleanisDelimiterWhitespace(int ch) booleanstatic final booleanisWhitespace(int ch) Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'.static final booleanisWhitespace(int ch, boolean isWhitespace) Checks whether a character is a whitespace.longlength()longbooleanvoidintread()booleanreadLineSegment(byte[] input) Reads data into the provided byte[].booleanreadLineSegment(byte[] input, boolean isNullWhitespace) Reads data into the provided byte[].readString(int size) voidseek(long pos) voidthrowError(String error)
-
Field Details
-
outBuf
-
delims
public static final boolean[] delims -
EMPTY
- See Also:
-
file
-
type
-
stringValue
-
reference
protected int reference -
generation
protected int generation -
hexString
protected boolean hexString
-
-
Constructor Details
-
PRTokeniser
Creates a PRTokeniser for the specifiedRandomAccessFileOrArray. The beginning of the file is read to determine the location of the header, and the data source is adjusted as necessary to account for any junk that occurs in the byte source before the header- Parameters:
file- the source
-
-
Method Details
-
seek
- Throws:
IOException
-
getFilePointer
- Throws:
IOException
-
close
- Throws:
IOException
-
length
- Throws:
IOException
-
read
- Throws:
IOException
-
getSafeFile
-
getFile
-
readString
- Throws:
IOException
-
isWhitespace
public static final boolean isWhitespace(int ch) Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'.
The same as callingisWhiteSpace(ch, true).- Parameters:
ch- int- Returns:
- boolean
- Since:
- 5.5.1
-
isWhitespace
public static final boolean isWhitespace(int ch, boolean isWhitespace) Checks whether a character is a whitespace. Currently checks on the following: '0', '9', '10', '12', '13', '32'.- Parameters:
ch- intisWhitespace- boolean- Returns:
- boolean
- Since:
- 5.5.1
-
isDelimiter
public static final boolean isDelimiter(int ch) -
isDelimiterWhitespace
public static final boolean isDelimiterWhitespace(int ch) -
getTokenType
-
getStringValue
-
getReference
public int getReference()Gets current reference number. If parsing was failed with NumberFormatException -1 will be return.- Returns:
- a positive integer for correct reference, or negative for incorrect.
-
getGeneration
public int getGeneration() -
backOnePosition
public void backOnePosition(int ch) -
throwError
- Throws:
IOException
-
getHeaderOffset
- Throws:
IOException
-
checkPdfHeader
- Throws:
IOException
-
checkFdfHeader
- Throws:
IOException
-
getStartxref
- Throws:
IOException
-
getHex
public static int getHex(int v) -
nextValidToken
- Throws:
IOException
-
nextToken
- Throws:
IOException
-
longValue
public long longValue() -
intValue
public int intValue() -
readLineSegment
Reads data into the provided byte[]. Checks on leading whitespace. SeeisWhiteSpace(int)orisWhiteSpace(int, boolean)for a list of whitespace characters.
The same as callingreadLineSegment(input, true).- Parameters:
input- byte[]- Returns:
- boolean
- Throws:
IOException- Since:
- 5.5.1
-
readLineSegment
Reads data into the provided byte[]. Checks on leading whitespace. SeeisWhiteSpace(int)orisWhiteSpace(int, boolean)for a list of whitespace characters.- Parameters:
input- byte[]isNullWhitespace- boolean to indicate whether '0' is whitespace or not. If in doubt, use true or overloaded methodreadLineSegment(input)- Returns:
- boolean
- Throws:
IOException- Since:
- 5.5.1
-
checkObjectStart
public static long[] checkObjectStart(byte[] line) -
isHexString
public boolean isHexString()
-