You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/12/30 12:20:40 UTC
svn commit: r1884936 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Author: lehmi
Date: Wed Dec 30 12:20:40 2020
New Revision: 1884936
URL: http://svn.apache.org/viewvc?rev=1884936&view=rev
Log:
PDFBOX-4952: remove unneeded object set
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1884936&r1=1884935&r2=1884936&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Wed Dec 30 12:20:40 2020
@@ -196,7 +196,6 @@ public class COSWriter implements ICOSVi
// the list of x ref entries to be made so far
private final List<XReferenceEntry> xRefEntries = new ArrayList<>();
- private final Set<COSBase> objectsToWriteSet = new HashSet<>();
//A list of objects to write.
private final Deque<COSBase> objectsToWrite = new LinkedList<>();
@@ -368,16 +367,6 @@ public class COSWriter implements ICOSVi
}
/**
- * This will get all available object keys.
- *
- * @return A map of all object keys.
- */
- public Map<COSBase,COSObjectKey> getObjectKeys()
- {
- return objectKeys;
- }
-
- /**
* This will get the output stream.
*
* @return The output stream.
@@ -558,9 +547,7 @@ public class COSWriter implements ICOSVi
{
while (!objectsToWrite.isEmpty())
{
- COSBase nextObject = objectsToWrite.removeFirst();
- objectsToWriteSet.remove(nextObject);
- doWriteObject( nextObject );
+ doWriteObject(objectsToWrite.removeFirst());
}
}
@@ -576,30 +563,29 @@ public class COSWriter implements ICOSVi
actual = ((COSObject)actual).getObject();
}
- if( !writtenObjects.contains( object ) &&
- !objectsToWriteSet.contains( object ) &&
- !actualsAdded.contains( actual ) )
+ if (!writtenObjects.contains(object) //
+ && !objectsToWrite.contains(object) //
+ && !actualsAdded.contains(actual))
{
- COSBase cosBase=null;
+ COSBase cosBase = null;
COSObjectKey cosObjectKey = null;
- if(actual != null)
+ if (actual != null)
{
- cosObjectKey= objectKeys.get(actual);
+ cosObjectKey = objectKeys.get(actual);
}
- if(cosObjectKey!=null)
+ if (cosObjectKey != null)
{
cosBase = keyObject.get(cosObjectKey);
}
- if (actual != null && objectKeys.containsKey(actual)
- && !isNeedToBeUpdated(object) && !isNeedToBeUpdated(cosBase))
+ if (actual != null && objectKeys.containsKey(actual) && !isNeedToBeUpdated(object)
+ && !isNeedToBeUpdated(cosBase))
{
return;
}
- objectsToWrite.add( object );
- objectsToWriteSet.add( object );
- if( actual != null )
+ objectsToWrite.add(object);
+ if (actual != null)
{
- actualsAdded.add( actual );
+ actualsAdded.add(actual);
}
}
}