public class ContentStreamParser extends Object
| Constructor and Description |
|---|
ContentStreamParser(PDContentStream stream) |
ContentStreamParser(org.sejda.io.SeekableSource source) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the
SeekableSource this reader was created from. |
boolean |
isNextToken(String... values) |
long |
length() |
Object |
nextParsedToken() |
long |
position() |
void |
position(long offset)
seeks to the given offset
|
int |
readGenerationNumber()
reads an integer and throws an
IOException if the integer value has more than the maximum object revision
(i.e. |
String |
readHexString()
Reads a token conforming with PDF Hexadecimal Strings chap 7.3.4.3 PDF 32000-1:2008.
|
int |
readInt() |
String |
readIntegerNumber()
Reads a a token conforming with a PDF Integer object defined in Numeric Objects chap 7.3.3 PDF 32000-1:2008.
|
String |
readLine()
Reads bytes until the first end of line marker occurs.
|
String |
readLiteralString()
Reads a token conforming with PDF Literal Strings chap 7.3.4.2 PDF 32000-1:2008.
|
long |
readLong() |
String |
readName()
Reads a token conforming with PDF Name Objects chap 7.3.5 PDF 32000-1:2008.
|
String |
readNumber()
Reads a token conforming with PDF Numeric Objects chap 7.3.3 PDF 32000-1:2008.
|
long |
readObjectNumber()
Reads a long and throws an
IOException if the long value is negative or has more than 10 digits (i.e. |
String |
readToken() |
void |
skipExpected(char ec)
Skips one char and throws an exception if it is not the expected value.
|
void |
skipExpected(String expected)
Skips the expected given String
|
void |
skipExpectedIndirectObjectDefinition(COSObjectKey expected)
Skips an indirect object definition open tag (Ex.
|
void |
skipIndirectObjectDefinition()
Skips an indirect object definition open tag (Ex.
|
void |
skipSpaces()
Skips all spaces and comments that are present.
|
boolean |
skipTokenIfValue(String... values)
Skips the next token if it's value is one of the given ones
|
org.sejda.io.SeekableSource |
source() |
List<Object> |
tokens() |
void |
unreadIfValid(int c)
Unreads the given character if it's not -1
|
void |
unreadSpaces()
Unreads white spaces
|
void |
unreadUntilSpaces()
Unreads characters until it finds a white space
|
public static final String OBJ
public ContentStreamParser(PDContentStream stream) throws IOException
IOExceptionpublic ContentStreamParser(org.sejda.io.SeekableSource source)
public List<Object> tokens() throws IOException
IOExceptionpublic Object nextParsedToken() throws IOException
IOExceptionpublic void close()
throws IOException
SeekableSource this reader was created from.close in interface Closeableclose in interface AutoCloseableIOExceptionpublic org.sejda.io.SeekableSource source()
public long position()
throws IOException
IOExceptionSeekableSource#position()}public void position(long offset)
throws IOException
offset - the new offsetIOExceptionSeekableSource#position(long)}public long length()
SeekableSource#size()}public final void skipExpected(String expected) throws IOException
expectedString - the String value that is expected.IOException - if the String char is not the expected value or if an I/O error occurs.public void skipExpected(char ec)
throws IOException
ec - the char value that is expected.IOException - if the read char is not the expected value or if an I/O error occurs.public boolean skipTokenIfValue(String... values) throws IOException
values - the values to skipIOException - if there is an error reading from the streampublic void skipIndirectObjectDefinition()
throws IOException
IOException - if we are reading a not valid indirect object definition open tagpublic void skipExpectedIndirectObjectDefinition(COSObjectKey expected) throws IOException
expected - object we are expecting to findIOException - if we are reading a not valid indirect object definition open tag or the object number or
generation number don't match the expected objectpublic String readToken() throws IOException
IOException - If there is an error reading from the stream.CharUtils.isEndOfName(int)public void unreadSpaces()
throws IOException
IOExceptionpublic void unreadUntilSpaces()
throws IOException
IOExceptionpublic boolean isNextToken(String... values) throws IOException
valid - values for the next token.IOException - if there is an error reading from the streampublic String readLine() throws IOException
IOException - If there is an error reading from the stream.public long readObjectNumber()
throws IOException
IOException if the long value is negative or has more than 10 digits (i.e. :
bigger than OBJECT_NUMBER_THRESHOLD)IOException - if an I/O error occurspublic int readGenerationNumber()
throws IOException
IOException if the integer value has more than the maximum object revision
(i.e. : bigger than GENERATION_NUMBER_THRESHOLD)IOException - if an I/O error occurspublic String readName() throws IOException
IOException - if an I/O error occurspublic int readInt()
throws IOException
IOException - If there is an error reading from the stream.public long readLong()
throws IOException
IOException - If there is an error reading from the stream.public final String readIntegerNumber() throws IOException
Integer or Long.IOException - If there is an error reading from the stream.public final String readNumber() throws IOException
IOException - If there is an error reading from the stream.public final String readHexString() throws IOException
IOException - If there is an error reading from the stream.public String readLiteralString() throws IOException
IOException - If there is an error during parsing.public void skipSpaces()
throws IOException
IOException - If there is an error reading from the stream.public void unreadIfValid(int c)
throws IOException
c - IOExceptionCopyright © 2019 sejda. All rights reserved.