commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1775930 - /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
Date Fri, 23 Dec 2016 23:26:39 GMT
Author: ggregory
Date: Fri Dec 23 23:26:38 2016
New Revision: 1775930

URL: http://svn.apache.org/viewvc?rev=1775930&view=rev
Log:
Use try with resources.

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1775930&r1=1775929&r2=1775930&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
Fri Dec 23 23:26:38 2016
@@ -314,9 +314,10 @@ public class TiffImageWriterLossless ext
 
         // write in the new items
         for (final TiffOutputItem outputItem : outputItems) {
-            final BufferOutputStream tos = new BufferOutputStream(output, (int) outputItem.getOffset());
-            final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
-            outputItem.writeItem(bos);
+            try (final BinaryOutputStream bos = new BinaryOutputStream(
+                    new BufferOutputStream(output, (int) outputItem.getOffset()), byteOrder))
{
+                outputItem.writeItem(bos);
+            }
         }
 
         os.write(output);



Mime
View raw message