@Override public boolean nextValidToken() throws IOException { getTokeniser().nextValidToken(); switch (getTokeniser().getTokenType()) { case StartArray: ++openArraysCount; break; case EndArray: --openArraysCount; break; case StartDic: ++openDictionaryCount; break; case EndDic: --openDictionaryCount; break; case Obj: case EndObj: throw new RuntimeException(getTokeniser().getTokenType() + LoggerMessages.CHUNK_OF_THIS_TYPE_NOT_ALLOWED_HERE); case EndOfFile: return false; default: break; } return true; } }
protected PdfDictionary readXrefSection() throws IOException { tokens.nextValidToken(); if (!tokens.tokenValueEqualsTo(PdfTokenizer.Xref)) tokens.throwError(PdfException.XrefSubsectionNotFound); PdfXrefTable xref = pdfDocument.getXref(); while (true) { tokens.nextValidToken(); if (tokens.tokenValueEqualsTo(PdfTokenizer.Trailer)) { break; tokens.nextValidToken(); if (tokens.getTokenType() != PdfTokenizer.TokenType.Number) { tokens.throwError(PdfException.NumberOfEntriesInThisXrefSubsectionNotFound); tokens.nextValidToken(); long pos = tokens.getLongValue(); tokens.nextValidToken(); int gen = tokens.getIntValue(); tokens.nextValidToken(); if (pos == 0L && gen == 65535 && num == 1 && start != 0) {
protected PdfDictionary readDictionary(boolean objStm) throws IOException { PdfDictionary dic = new PdfDictionary(); while (true) { tokens.nextValidToken(); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) break; if (tokens.getTokenType() != PdfTokenizer.TokenType.Name) tokens.throwError(PdfException.DictionaryKey1IsNotAName, tokens.getStringValue()); PdfName name = readPdfName(true); PdfObject obj = readObject(true, objStm); if (obj == null) { if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) tokens.throwError(PdfException.UnexpectedGtGt); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndArray) tokens.throwError(PdfException.UnexpectedCloseBracket); } dic.put(name, obj); } return dic; }
tokens.nextValidToken(); readObject(false, false); } catch (IOException e) {
tokens.nextValidToken(); readObject(false, false); } catch (IOException e) {
PdfDictionary dic = new PdfDictionary(); while (!rangeIsCorrect) { tokens.nextValidToken(); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) { currentLevel--;
try { tokens.seek(reference.getOffset()); tokens.nextValidToken(); if (tokens.getTokenType() != PdfTokenizer.TokenType.Obj || tokens.getObjNr() != reference.getObjNumber()
PdfDictionary dic = new PdfDictionary(); while (!rangeIsCorrect) { tokens.nextValidToken(); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) { currentLevel--;
protected PdfObject readObject(boolean readAsDirect, boolean objStm) throws IOException { tokens.nextValidToken(); PdfTokenizer.TokenType type = tokens.getTokenType(); switch (type) {