test/java/io/FileInputStream/LargeFileAvailable.java

Print this page

        

@@ -29,10 +29,11 @@
  */
 
 import java.io.*;
 import java.nio.ByteBuffer;
 import java.nio.channels.*;
+import java.nio.file.Files;
 import static java.nio.file.StandardOpenOption.*;
 
 public class LargeFileAvailable {
     private static final long FILESIZE = 7405576182L;
     public static void main(String args[]) throws Exception {

@@ -83,11 +84,11 @@
 
     private static File createLargeFile(long filesize) throws Exception {
         // Create a large file as a sparse file if possible
         File largefile = File.createTempFile("largefile", null);
         // re-create as a sparse file
-        largefile.toPath().delete();
+        Files.delete(largefile.toPath());
         try (FileChannel fc =
                 FileChannel.open(largefile.toPath(),
                                  CREATE_NEW, WRITE, SPARSE)) {
             ByteBuffer bb = ByteBuffer.allocate(1).put((byte)1);
             bb.rewind();