@@ -285,7 +285,7 @@ public static Checksum checksum(final File file, final Checksum checksum) throws
285285 requireExistsChecked (file , "file" );
286286 requireFile (file , "file" );
287287 Objects .requireNonNull (checksum , "checksum" );
288- try (InputStream inputStream = new CheckedInputStream (new FileInputStream (file ), checksum )) {
288+ try (InputStream inputStream = new CheckedInputStream (Files . newInputStream (file . toPath () ), checksum )) {
289289 IOUtils .consume (inputStream );
290290 }
291291 return checksum ;
@@ -405,7 +405,7 @@ public static boolean contentEquals(final File file1, final File file2) throws I
405405 return true ;
406406 }
407407
408- try (InputStream input1 = new FileInputStream (file1 ) ; InputStream input2 = new FileInputStream (file2 )) {
408+ try (InputStream input1 = Files . newInputStream (file1 . toPath ()) ; InputStream input2 = Files . newInputStream (file2 . toPath () )) {
409409 return IOUtils .contentEquals (input1 , input2 );
410410 }
411411 }
@@ -456,8 +456,8 @@ public static boolean contentEqualsIgnoreEOL(final File file1, final File file2,
456456 }
457457
458458 final Charset charset = Charsets .toCharset (charsetName );
459- try (Reader input1 = new InputStreamReader (new FileInputStream (file1 ), charset );
460- Reader input2 = new InputStreamReader (new FileInputStream (file2 ), charset )) {
459+ try (Reader input1 = new InputStreamReader (Files . newInputStream (file1 . toPath () ), charset );
460+ Reader input2 = new InputStreamReader (Files . newInputStream (file2 . toPath () ), charset )) {
461461 return IOUtils .contentEqualsIgnoreEOL (input1 , input2 );
462462 }
463463 }
@@ -868,7 +868,7 @@ public static void copyFile(final File srcFile, final File destFile, final CopyO
868868 * @since 2.1
869869 */
870870 public static long copyFile (final File input , final OutputStream output ) throws IOException {
871- try (FileInputStream fis = new FileInputStream (input )) {
871+ try (InputStream fis = Files . newInputStream (input . toPath () )) {
872872 return IOUtils .copyLarge (fis , output );
873873 }
874874 }
0 commit comments