public class PRTokeniser extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PRTokeniser.TokenType
Enum representing the possible token types
|
| Modifier and Type | Field and Description |
|---|---|
static boolean[] |
delims |
protected int |
generation |
protected boolean |
hexString |
protected int |
reference |
protected String |
stringValue |
protected PRTokeniser.TokenType |
type |
| Constructor and Description |
|---|
PRTokeniser(RandomAccessFileOrArray file)
Creates a PRTokeniser for the specified
RandomAccessFileOrArray. |
| Modifier and Type | Method and Description |
|---|---|
void |
backOnePosition(int ch) |
void |
checkFdfHeader() |
static long[] |
checkObjectStart(byte[] line) |
char |
checkPdfHeader() |
void |
close() |
RandomAccessFileOrArray |
getFile() |
long |
getFilePointer() |
int |
getGeneration() |
int |
getHeaderOffset() |
static int |
getHex(int v) |
int |
getReference()
Gets current reference number.
|
RandomAccessFileOrArray |
getSafeFile() |
long |
getStartxref() |
String |
getStringValue() |
PRTokeniser.TokenType |
getTokenType() |
int |
intValue() |
static boolean |
isDelimiter(int ch) |
static boolean |
isDelimiterWhitespace(int ch) |
boolean |
isHexString() |
static boolean |
isWhitespace(int ch)
Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'.
|
static boolean |
isWhitespace(int ch,
boolean isWhitespace)
Checks whether a character is a whitespace.
|
long |
length() |
long |
longValue() |
boolean |
nextToken() |
void |
nextValidToken() |
int |
read() |
boolean |
readLineSegment(byte[] input)
Reads data into the provided byte[].
|
boolean |
readLineSegment(byte[] input,
boolean isNullWhitespace)
Reads data into the provided byte[].
|
String |
readString(int size) |
void |
seek(long pos) |
void |
throwError(String error) |
public static final boolean[] delims
protected PRTokeniser.TokenType type
protected String stringValue
protected int reference
protected int generation
protected boolean hexString
public PRTokeniser(RandomAccessFileOrArray file)
RandomAccessFileOrArray.
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 headerfile - the sourcepublic void seek(long pos)
throws IOException
IOExceptionpublic long getFilePointer()
throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic long length()
throws IOException
IOExceptionpublic int read()
throws IOException
IOExceptionpublic RandomAccessFileOrArray getSafeFile()
public RandomAccessFileOrArray getFile()
public String readString(int size) throws IOException
IOExceptionpublic static final boolean isWhitespace(int ch)
isWhiteSpace(ch, true).ch - intpublic static final boolean isWhitespace(int ch,
boolean isWhitespace)
ch - intisWhitespace - booleanpublic static final boolean isDelimiter(int ch)
public static final boolean isDelimiterWhitespace(int ch)
public PRTokeniser.TokenType getTokenType()
public String getStringValue()
public int getReference()
public int getGeneration()
public void backOnePosition(int ch)
public void throwError(String error) throws IOException
IOExceptionpublic int getHeaderOffset()
throws IOException
IOExceptionpublic char checkPdfHeader()
throws IOException
IOExceptionpublic void checkFdfHeader()
throws IOException
IOExceptionpublic long getStartxref()
throws IOException
IOExceptionpublic static int getHex(int v)
public void nextValidToken()
throws IOException
IOExceptionpublic boolean nextToken()
throws IOException
IOExceptionpublic long longValue()
public int intValue()
public boolean readLineSegment(byte[] input)
throws IOException
isWhiteSpace(int) or isWhiteSpace(int, boolean)
for a list of whitespace characters.
readLineSegment(input, true).input - byte[]IOExceptionpublic boolean readLineSegment(byte[] input,
boolean isNullWhitespace)
throws IOException
isWhiteSpace(int) or isWhiteSpace(int, boolean)
for a list of whitespace characters.input - byte[]isNullWhitespace - boolean to indicate whether '0' is whitespace or not.
If in doubt, use true or overloaded method readLineSegment(input)IOExceptionpublic static long[] checkObjectStart(byte[] line)
public boolean isHexString()
Copyright © 2024. All rights reserved.