diff options
author | Olivier Lamy <olamy@apache.org> | 2014-04-17 09:57:30 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-04-17 09:57:30 +1000 |
commit | bb3014071965a7a620284886aa3ccf96b7aa6d0e (patch) | |
tree | 863a676d9588f9b09c530350b519aaa0ee9ebdd2 /archiva-modules/archiva-base/archiva-checksum/src | |
parent | b2ebfd6cc257b7040644dc52e38aa5b8c4faaa4e (diff) | |
download | archiva-bb3014071965a7a620284886aa3ccf96b7aa6d0e.tar.gz archiva-bb3014071965a7a620284886aa3ccf96b7aa6d0e.zip |
using more java.nio.file
Diffstat (limited to 'archiva-modules/archiva-base/archiva-checksum/src')
-rw-r--r-- | archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java index 9e9378e3b..89181b5fd 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java @@ -27,6 +27,8 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -75,7 +77,7 @@ public class ChecksummedFile throws IOException { - try (FileInputStream fis = new FileInputStream( referenceFile )) + try (InputStream fis = Files.newInputStream( referenceFile.toPath() ) ) { Checksum checksum = new Checksum( checksumAlgorithm ); checksum.update( fis ); @@ -139,7 +141,7 @@ public class ChecksummedFile public boolean isValidChecksums( ChecksumAlgorithm algorithms[] ) { - try (FileInputStream fis = new FileInputStream( referenceFile )) + try (InputStream fis = Files.newInputStream( referenceFile.toPath() )) { List<Checksum> checksums = new ArrayList<>( algorithms.length ); // Create checksum object for each algorithm. @@ -228,7 +230,7 @@ public class ChecksummedFile } - try (FileInputStream fis = new FileInputStream( referenceFile )) + try (InputStream fis = Files.newInputStream( referenceFile.toPath() )) { // Parse file once, for all checksums. Checksum.update( checksums, fis ); |