File tree Expand file tree Collapse file tree
tools/src/main/java/org/apache/pdfbox/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535import org .apache .pdfbox .contentstream .PDFGraphicsStreamEngine ;
3636import org .apache .pdfbox .cos .COSName ;
3737import org .apache .pdfbox .cos .COSStream ;
38- import org .apache .pdfbox .io .IOUtils ;
3938import org .apache .pdfbox .pdmodel .PDDocument ;
4039import org .apache .pdfbox .pdmodel .PDPage ;
4140import org .apache .pdfbox .pdmodel .PDResources ;
@@ -415,10 +414,11 @@ else if ("jp2".equals(suffix))
415414 || PDDeviceRGB .INSTANCE .getName ().equals (colorSpaceName )))
416415 {
417416 // RGB or Gray colorspace: get and write the unmodified JPEG2000 stream
418- InputStream data = pdImage .createInputStream (
419- Collections .singletonList (COSName .JPX_DECODE .getName ()));
420- data .transferTo (imageOutput );
421- IOUtils .closeQuietly (data );
417+ try (InputStream data = pdImage .createInputStream (
418+ Collections .singletonList (COSName .JPX_DECODE .getName ())))
419+ {
420+ data .transferTo (imageOutput );
421+ }
422422 }
423423 else
424424 {
You can’t perform that action at this time.
0 commit comments