pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1799239 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java
Date Mon, 19 Jun 2017 17:12:49 GMT
Author: tilman
Date: Mon Jun 19 17:12:49 2017
New Revision: 1799239

URL: http://svn.apache.org/viewvc?rev=1799239&view=rev
Log:
PDFBOX-2852: use jdk7 syntax

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java?rev=1799239&r1=1799238&r2=1799239&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java
Mon Jun 19 17:12:49 2017
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
-import org.apache.pdfbox.io.IOUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
 import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
@@ -130,16 +129,10 @@ public final class ExtractEmbeddedFiles
         String embeddedFilename = filePath + filename;
         File file = new File(filePath + filename);
         System.out.println("Writing " + embeddedFilename);
-        FileOutputStream fos = null;
-        try
+        try (FileOutputStream fos = new FileOutputStream(file))
         {
-            fos = new FileOutputStream(file);
             fos.write(embeddedFile.toByteArray());
         }
-        finally
-        {
-            IOUtils.closeQuietly(fos);
-        }
     }
     
     private static PDEmbeddedFile getEmbeddedFile(PDComplexFileSpecification fileSpec )



Mime
View raw message