public class PDFStreamParser extends BaseParser
Modifier and Type | Field and Description |
---|---|
private byte[] |
binCharTestArr |
private static org.apache.commons.logging.Log |
LOG
Log instance.
|
private static int |
MAX_BIN_CHAR_TEST_LENGTH |
private java.util.List<java.lang.Object> |
streamObjects |
A, ASCII_CR, ASCII_LF, B, D, DEF, document, E, ENDOBJ_STRING, ENDSTREAM_STRING, J, M, MAX_LENGTH_LONG, N, O, R, S, seqSource, STREAM_STRING, T
Constructor and Description |
---|
PDFStreamParser(byte[] bytes)
Constructor.
|
PDFStreamParser(COSStream stream)
Deprecated.
Use
PDFStreamParser(PDContentStream) instead. |
PDFStreamParser(PDContentStream contentStream)
Constructor.
|
PDFStreamParser(PDStream stream)
Deprecated.
Use
PDFStreamParser(PDContentStream) instead. |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.Object> |
getTokens()
This will get the tokens that were parsed from the stream by the
parse() method. |
private boolean |
hasNextSpaceOrReturn()
Checks if the next char is a space or a return.
|
private boolean |
hasNoFollowingBinData(SequentialSource pdfSource)
Looks up an amount of bytes if they contain only ASCII characters (no
control sequences etc.), and that these ASCII characters begin with a
sequence of 1-3 non-blank characters between blanks
|
private boolean |
isSpaceOrReturn(int c) |
void |
parse()
This will parse all the tokens in the stream.
|
java.lang.Object |
parseNextToken()
This will parse the next token in the stream.
|
protected java.lang.String |
readOperator()
This will read an operator from the stream.
|
isClosing, isClosing, isDigit, isDigit, isEndOfName, isEOL, isEOL, isSpace, isSpace, isWhitespace, isWhitespace, parseBoolean, parseCOSArray, parseCOSDictionary, parseCOSName, parseCOSString, parseDirObject, readExpectedChar, readExpectedString, readExpectedString, readGenerationNumber, readInt, readLine, readLong, readObjectNumber, readString, readString, readStringNumber, skipSpaces, skipWhiteSpaces
private static final org.apache.commons.logging.Log LOG
private final java.util.List<java.lang.Object> streamObjects
private static final int MAX_BIN_CHAR_TEST_LENGTH
private final byte[] binCharTestArr
@Deprecated public PDFStreamParser(PDStream stream) throws java.io.IOException
PDFStreamParser(PDContentStream)
instead.stream
- The stream to parse.java.io.IOException
- If there is an error initializing the stream.@Deprecated public PDFStreamParser(COSStream stream) throws java.io.IOException
PDFStreamParser(PDContentStream)
instead.stream
- The stream to parse.java.io.IOException
- If there is an error initializing the stream.public PDFStreamParser(PDContentStream contentStream) throws java.io.IOException
contentStream
- The content stream to parse.java.io.IOException
- If there is an error initializing the stream.public PDFStreamParser(byte[] bytes) throws java.io.IOException
bytes
- the bytes to parse.java.io.IOException
- If there is an error initializing the stream.public void parse() throws java.io.IOException
getTokens()
.java.io.IOException
- If there is an error while parsing the stream.public java.util.List<java.lang.Object> getTokens()
parse()
method.public java.lang.Object parseNextToken() throws java.io.IOException
java.io.IOException
- If an io error occurs while parsing the stream.private boolean hasNoFollowingBinData(SequentialSource pdfSource) throws java.io.IOException
true
if next bytes are probably printable ASCII
characters starting with a PDF operator, otherwise false
java.io.IOException
protected java.lang.String readOperator() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.private boolean isSpaceOrReturn(int c)
private boolean hasNextSpaceOrReturn() throws java.io.IOException
java.io.IOException
- if something went wrong