private COSBase getObjectFromPool(COSObjectKey key) throws IOException { if (document == null) { throw new IOException("object reference " + key + " at offset " + seqSource.getPosition() + " in content stream"); } return document.getObjectFromPool(key); }
/** * Read one char and throw an exception if it is not the expected value. * * @param ec the char value that is expected. * @throws IOException if the read char is not the expected value or if an * I/O error occurs. */ protected void readExpectedChar(char ec) throws IOException { char c = (char) seqSource.read(); if (c != ec) { throw new IOException("expected='" + ec + "' actual='" + c + "' at offset " + seqSource.getPosition()); } }
+ "' at offset " + seqSource.getPosition()); + "' at offset " + seqSource.getPosition()); + "' at offset " + seqSource.getPosition());
/** * This will read an long from the stream. * * @return The long that was read from the stream. * * @throws IOException If there is an error reading from the stream. */ protected long readLong() throws IOException { skipSpaces(); long retval = 0; StringBuilder longBuffer = readStringNumber(); try { retval = Long.parseLong( longBuffer.toString() ); } catch( NumberFormatException e ) { seqSource.unread(longBuffer.toString().getBytes(ISO_8859_1)); throw new IOException( "Error: Expected a long type at offset " + seqSource.getPosition() + ", instead got '" + longBuffer + "'", e); } return retval; }
/** * This will read an integer from the stream. * * @return The integer that was read from the stream. * * @throws IOException If there is an error reading from the stream. */ protected int readInt() throws IOException { skipSpaces(); int retval = 0; StringBuilder intBuffer = readStringNumber(); try { retval = Integer.parseInt( intBuffer.toString() ); } catch( NumberFormatException e ) { seqSource.unread(intBuffer.toString().getBytes(ISO_8859_1)); throw new IOException( "Error: Expected an integer type at offset "+ seqSource.getPosition(), e); } return retval; }
"' is getting too long, stop reading at offset " + seqSource.getPosition());
/** * Reads given pattern from {@link #seqSource}. Skipping whitespace at start and end if wanted. * * @param expectedString pattern to be skipped * @param skipSpaces if set to true spaces before and after the string will be skipped * @throws IOException if pattern could not be read */ protected final void readExpectedString(final char[] expectedString, boolean skipSpaces) throws IOException { skipSpaces(); for (char c : expectedString) { if (seqSource.read() != c) { throw new IOException("Expected string '" + new String(expectedString) + "' but missed at character '" + c + "' at offset " + seqSource.getPosition()); } } skipSpaces(); }
pdfSource.getPosition());
nextChar + "' at offset " + seqSource.getPosition());
long numOffset = seqSource.getPosition(); COSBase value = parseDirObject(); skipSpaces(); long genOffset = seqSource.getPosition(); COSBase generationNumber = parseDirObject(); skipSpaces();
private void parseCOSDictionaryNameValuePair(COSDictionary obj) throws IOException { COSName key = parseCOSName(); COSBase value = parseCOSDictionaryValue(); skipSpaces(); if (((char) seqSource.peek()) == 'd') { // if the next string is 'def' then we are parsing a cmap stream // and want to ignore it, otherwise throw an exception. String potentialDEF = readString(); if (!potentialDEF.equals(DEF)) { seqSource.unread(potentialDEF.getBytes(ISO_8859_1)); } else { skipSpaces(); } } if (value == null) { LOG.warn("Bad dictionary declaration at offset " + seqSource.getPosition()); } else { // label this item as direct, to avoid signature problems. value.setDirect(true); obj.setItem(key, value); } }
"' at offset " + seqSource.getPosition()); "' at offset " + seqSource.getPosition()); + "' peekInt=" + peek + " at offset " + seqSource.getPosition() );
LOG.warn("Invalid dictionary, found: '" + c + "' but expected: '/' at offset " + seqSource.getPosition()); if (readUntilEndOfCOSDictionary())
long startPosition = seqSource.getPosition(); readExpectedChar('['); COSArray po = new COSArray(); seqSource.getPosition() + ", start offset: " + startPosition);
if (imageData.getImageData() == null || imageData.getImageData().length == 0) LOG.warn("empty inline image at stream offset " + seqSource.getPosition()); "' at stream offset " + seqSource.getPosition());
private COSBase getObjectFromPool(COSObjectKey key) throws IOException { if (document == null) { throw new IOException("object reference " + key + " at offset " + seqSource.getPosition() + " in content stream"); } return document.getObjectFromPool(key); }
private COSBase getObjectFromPool(COSObjectKey key) throws IOException { if (document == null) { throw new IOException("object reference " + key + " at offset " + seqSource.getPosition() + " in content stream"); } return document.getObjectFromPool(key); }
/** * Read one char and throw an exception if it is not the expected value. * * @param ec the char value that is expected. * @throws IOException if the read char is not the expected value or if an * I/O error occurs. */ protected void readExpectedChar(char ec) throws IOException { char c = (char) seqSource.read(); if (c != ec) { throw new IOException("expected='" + ec + "' actual='" + c + "' at offset " + seqSource.getPosition()); } }
/** * Read one char and throw an exception if it is not the expected value. * * @param ec the char value that is expected. * @throws IOException if the read char is not the expected value or if an * I/O error occurs. */ protected void readExpectedChar(char ec) throws IOException { char c = (char) seqSource.read(); if (c != ec) { throw new IOException("expected='" + ec + "' actual='" + c + "' at offset " + seqSource.getPosition()); } }
/** * Reads given pattern from {@link #seqSource}. Skipping whitespace at start and end if wanted. * * @param expectedString pattern to be skipped * @param skipSpaces if set to true spaces before and after the string will be skipped * @throws IOException if pattern could not be read */ protected final void readExpectedString(final char[] expectedString, boolean skipSpaces) throws IOException { skipSpaces(); for (char c : expectedString) { if (seqSource.read() != c) { throw new IOException("Expected string '" + new String(expectedString) + "' but missed at character '" + c + "' at offset " + seqSource.getPosition()); } } skipSpaces(); }