/** * Reads data into the provided byte[]. Checks on leading whitespace. * See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)} * for a list of whitespace characters. * <br> * The same as calling {@link #readLineSegment(com.itextpdf.io.source.ByteBuffer, boolean) readLineSegment(input, true)}. * * @param buffer @see ByteBuffer * @return boolean * @throws java.io.IOException */ public boolean readLineSegment(ByteBuffer buffer) throws java.io.IOException { return readLineSegment(buffer, true); }
/** * Reads data into the provided byte[]. Checks on leading whitespace. * See {@link #isWhitespace(int) isWhiteSpace(int)} or {@link #isWhitespace(int, boolean) isWhiteSpace(int, boolean)} * for a list of whitespace characters. * <br> * The same as calling {@link #readLineSegment(com.itextpdf.io.source.ByteBuffer, boolean) readLineSegment(input, true)}. * * @param buffer @see ByteBuffer * @return boolean * @throws java.io.IOException */ public boolean readLineSegment(ByteBuffer buffer) throws java.io.IOException { return readLineSegment(buffer, true); }
pos = tokens.getPosition(); line.reset(); if (!tokens.readLineSegment(line, false)) // added boolean because of mailing list issue (17 Feb. 2014) break; if (line.startsWith(endstream)) {
protected void fixXref() throws IOException { fixedXref = true; PdfXrefTable xref = pdfDocument.getXref(); tokens.seek(0); ByteBuffer buffer = new ByteBuffer(24); PdfTokenizer lineTokeniser = new PdfTokenizer(new RandomAccessFileOrArray(new ReusableRandomAccessSource(buffer))); for (; ; ) { long pos = tokens.getPosition(); buffer.reset(); if (!tokens.readLineSegment(buffer, true)) // added boolean because of mailing list issue (17 Feb. 2014) break; if (buffer.get(0) >= '0' && buffer.get(0) <= '9') { int[] obj = PdfTokenizer.checkObjectStart(lineTokeniser); if (obj == null) continue; int num = obj[0]; int gen = obj[1]; PdfIndirectReference reference = xref.get(num); if (reference != null && reference.getGenNumber() == gen) { reference.fixOffset(pos); } } } }
long pos = tokens.getPosition(); buffer.reset(); if (!tokens.readLineSegment(buffer, true)) // added boolean because of mailing list issue (17 Feb. 2014) break; if (buffer.get(0) == 't') {