[JENKINS-42934] Avoid using new FileInputStream / new FileOutputStream

This commit is contained in:
Stephen Connolly committed 2017-03-20 12:50:46 +00:00
1 parent 4948d6c556
commit f0cd7ae8ff
41 files changed
+188 -159

No files matched your search

+3 -3
View File
@@ -198,7 +198,7 @@ public class Util {
StringBuilder str = new StringBuilder((int)logfile.length());
try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(logfile), charset))) {
try (BufferedReader r = new BufferedReader(new InputStreamReader(Files.newInputStream(logfile.toPath()), charset))) {
char[] buf = new char[1024];
int len;
while ((len = r.read(buf, 0, buf.length)) > 0)
@@ -800,7 +800,7 @@ public class Util {
*/
@Nonnull
public static String getDigestOf(@Nonnull File file) throws IOException {
try (InputStream is = new FileInputStream(file)) {
try (InputStream is = Files.newInputStream(file.toPath())) {
return getDigestOf(new BufferedInputStream(is));
}
}
@@ -1134,7 +1134,7 @@ public class Util {
* Creates an empty file.
*/
public static void touch(@Nonnull File file) throws IOException {
new FileOutputStream(file).close();
Files.newOutputStream(file.toPath()).close();
}
/**