You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/12/22 04:25:01 UTC
svn commit: r1647237 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Author: tilman
Date: Mon Dec 22 03:25:01 2014
New Revision: 1647237
URL: http://svn.apache.org/r1647237
Log:
PDFBOX-2576: delete methods with one or zero LoC, that were sometimes used and sometimes not
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1647237&r1=1647236&r2=1647237&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java Mon Dec 22 03:25:01 2014
@@ -632,7 +632,7 @@ public class NonSequentialPDFParser exte
*/
private COSDictionary parseXref(long startXRefOffset) throws IOException
{
- setPdfSource(startXRefOffset);
+ pdfSource.seek(startXRefOffset);
parseStartXref();
long startXrefOffset = document.getStartXref();
@@ -649,7 +649,7 @@ public class NonSequentialPDFParser exte
while (prev > -1)
{
// seek to xref table
- setPdfSource(prev);
+ pdfSource.seek(prev);
// skip white spaces
skipSpaces();
@@ -689,7 +689,7 @@ public class NonSequentialPDFParser exte
streamOffset = (int)fixedOffset;
trailer.setInt(COSName.XREF_STM, streamOffset);
}
- setPdfSource(streamOffset);
+ pdfSource.seek(streamOffset);
skipSpaces();
parseXrefObjStream(prev, false);
}
@@ -752,44 +752,6 @@ public class NonSequentialPDFParser exte
}
// ------------------------------------------------------------------------
- /** Get current offset in file at which next byte would be read. */
- private long getPdfSourceOffset()
- {
- return pdfSource.getOffset();
- }
-
- /**
- * Sets {@link #pdfSource} to start next parsing at given file offset.
- *
- * @param fileOffset file offset
- * @throws IOException If something went wrong.
- */
- protected final void setPdfSource(long fileOffset) throws IOException
- {
- pdfSource.seek(fileOffset);
-
- // alternative using 'old fashioned' input stream
- // if ( pdfSource != null )
- // pdfSource.close();
- //
- // pdfSource = new PushBackInputStream(
- // new BufferedInputStream(
- // new FileInputStream( file ), 16384), 4096);
- // pdfSource.skip( _fileOffset );
- }
-
- /**
- * Enable handling of alternative pdfSource implementation.
- *
- * @throws IOException If something went wrong.
- */
- protected final void releasePdfSourceInputStream() throws IOException
- {
- // if ( pdfSource != null )
- // pdfSource.close();
- }
-
- // ------------------------------------------------------------------------
/**
* Looks for and parses startxref. We first look for last '%%EOF' marker (within last
* {@link #DEFAULT_TRAIL_BYTECOUNT} bytes (or range set via {@link #setEOFLookupRange(int)}) and go back to find
@@ -1460,7 +1422,7 @@ public class NonSequentialPDFParser exte
{
// offset of indirect object in file
// ---- go to object start
- setPdfSource(offsetOrObjstmObNr);
+ pdfSource.seek(offsetOrObjstmObNr);
// ---- we must have an indirect object
final long readObjNr = readObjectNumber();
@@ -1537,8 +1499,6 @@ public class NonSequentialPDFParser exte
+ " does not end with 'endobj' but with '" + endObjectKey + "'");
}
}
-
- releasePdfSourceInputStream();
}
else
{
@@ -1687,13 +1647,12 @@ public class NonSequentialPDFParser exte
// not read so far
// keep current stream position
- final long curFileOffset = getPdfSourceOffset();
- releasePdfSourceInputStream();
+ final long curFileOffset = pdfSource.getOffset();
parseObjectDynamically(lengthObj, true);
// reset current stream position
- setPdfSource(curFileOffset);
+ pdfSource.seek(curFileOffset);
if (lengthObj.getObject() == null)
{
@@ -1905,7 +1864,7 @@ public class NonSequentialPDFParser exte
{
return startXRefOffset;
}
- setPdfSource(startXRefOffset-1);
+ pdfSource.seek(startXRefOffset-1);
// save th previous character
int previous = pdfSource.read();
if (pdfSource.peek() == X && checkBytesAtOffset(XREF_TABLE))
@@ -1926,7 +1885,7 @@ public class NonSequentialPDFParser exte
readObjectNumber();
readGenerationNumber();
readPattern(OBJ_MARKER);
- setPdfSource(startXRefOffset);
+ pdfSource.seek(startXRefOffset);
return startXRefOffset;
}
catch (IOException exception)