fix fallback to FileChannel using new IO APIs
@@ -8,6 +8,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
@@ -35,9 +36,8 @@ public interface OWALFile extends Closeable {
}
}
- if(path.toFile().exists()){
- path.toFile().delete();
- }
+ Files.deleteIfExists(path);
+
return new OWALChannelFile(
FileChannel.open(path, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND));
}
