diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-09-17 15:29:16 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-09-17 15:29:16 +0000 |
commit | 42996906392063b3423a68cf6fe99362e6ce9e9f (patch) | |
tree | f95c51a679faf9d8adc10c1ad6311b70ca1c502d /poi-examples/src | |
parent | 8514b659aef47a210d38ccbe59978a6926af5075 (diff) | |
download | poi-42996906392063b3423a68cf6fe99362e6ce9e9f.tar.gz poi-42996906392063b3423a68cf6fe99362e6ce9e9f.zip |
use files nio APIs in more places
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912367 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-examples/src')
-rw-r--r-- | poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java b/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java index db65f76787..a0a8177e87 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/ss/ConditionalFormats.java @@ -19,8 +19,10 @@ package org.apache.poi.examples.ss; -import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -93,7 +95,7 @@ public final class ConditionalFormats { if (wb instanceof XSSFWorkbook) { file += "x"; } - try (FileOutputStream out = new FileOutputStream(file)) { + try (OutputStream out = Files.newOutputStream(Paths.get(file))) { wb.write(out); } System.out.println("Generated: " + file); |