Package com.itextpdf.text.pdf
Class PRTokeniser
java.lang.Object
com.itextpdf.text.pdf.PRTokeniser
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the possible token types -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean[]
(package private) static final String
private final RandomAccessFileOrArray
protected int
protected boolean
private final StringBuilder
protected int
protected String
protected PRTokeniser.TokenType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
backOnePosition
(int ch) void
static long[]
checkObjectStart
(byte[] line) char
void
close()
getFile()
long
int
int
static int
getHex
(int v) int
Gets current reference number.long
int
intValue()
static final boolean
isDelimiter
(int ch) static final boolean
isDelimiterWhitespace
(int ch) boolean
static final boolean
isWhitespace
(int ch) Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'.static final boolean
isWhitespace
(int ch, boolean isWhitespace) Checks whether a character is a whitespace.long
length()
long
boolean
void
int
read()
boolean
readLineSegment
(byte[] input) Reads data into the provided byte[].boolean
readLineSegment
(byte[] input, boolean isNullWhitespace) Reads data into the provided byte[].readString
(int size) void
seek
(long pos) void
throwError
(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()
-