You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ga...@apache.org on 2012/06/23 21:17:32 UTC
svn commit: r1353183 -
/xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java
Author: gadams
Date: Sat Jun 23 19:17:31 2012
New Revision: 1353183
URL: http://svn.apache.org/viewvc?rev=1353183&view=rev
Log:
Fixed a performance problem and an unclosed InputStream in case of an IOException.
Modified:
xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java
Modified: xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java?rev=1353183&r1=1353182&r2=1353183&view=diff
==============================================================================
--- xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java (original)
+++ xmlgraphics/commons/branches/commons-1_5rc1/src/java/org/apache/xmlgraphics/ps/PSGenerator.java Sat Jun 23 19:17:31 2012
@@ -32,6 +32,8 @@ import java.util.Stack;
import javax.xml.transform.Source;
+import org.apache.commons.io.IOUtils;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -817,9 +819,6 @@ public class PSGenerator implements PSCo
return getResourceTracker().isResourceSupplied(res);
}
-<<<<<<< HEAD
- }
-=======
/**
* Embeds the Identity-H CMap file into the output stream, if that has not
* already been done.
@@ -835,11 +834,11 @@ public class PSGenerator implements PSCo
resTracker.registerNeededResource(getProcsetCIDInitResource());
writeDSCComment(DSCConstants.BEGIN_DOCUMENT, IDENTITY_H);
InputStream cmap = PSGenerator.class.getResourceAsStream(IDENTITY_H);
- int b;
- while ((b = cmap.read()) != -1) {
- out.write(b);
+ try {
+ IOUtils.copyLarge(cmap, out);
+ } finally {
+ IOUtils.closeQuietly(cmap);
}
- cmap.close();
writeDSCComment(DSCConstants.END_DOCUMENT);
resTracker.registerSuppliedResource(getIdentityHCMapResource());
identityHEmbedded = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org