Skip to content

Commit a13bebf

Browse files
committed
fix: avoid FileStream
1 parent 28644f0 commit a13bebf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/at/laborg/briss/CropManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.io.File;
3636
import java.io.FileOutputStream;
3737
import java.io.IOException;
38+
import java.nio.file.Files;
3839
import java.util.ArrayList;
3940
import java.util.List;
4041

@@ -80,7 +81,7 @@ private static File copyToMultiplePages(CropJob cropJob) throws IOException, Doc
8081
Document document = new Document();
8182

8283
File resultFile = File.createTempFile("cropped", ".pdf");
83-
PdfSmartCopy pdfCopy = new PdfSmartCopy(document, new FileOutputStream(resultFile));
84+
PdfSmartCopy pdfCopy = new PdfSmartCopy(document, Files.newOutputStream(resultFile.toPath()));
8485
document.open();
8586
PdfImportedPage page;
8687

@@ -101,7 +102,7 @@ private static File copyToMultiplePages(CropJob cropJob) throws IOException, Doc
101102
private static void cropMultipliedFile(File source, CropJob cropJob) throws DocumentException, IOException {
102103

103104
PdfReader reader = new PdfReader(source.getAbsolutePath());
104-
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(cropJob.getDestinationFile()));
105+
PdfStamper stamper = new PdfStamper(reader, Files.newOutputStream(cropJob.getDestinationFile().toPath()));
105106
stamper.setMoreInfo(cropJob.getSourceMetaInfo());
106107

107108
PdfDictionary pageDict;

0 commit comments

Comments
 (0)