快速创建3G大文件,耗时不到1S,写下载器可以用到。 
Path path = Paths.get("d:\\a.txt");
byte[] output = new byte[1];
ByteBuffer bf = ByteBuffer.wrap(output);
try(FileChannel fc = FileChannel.open(path, WRITE, CREATE)) {
fc.position((3L << 30) - 1);
fc.write(bf);
} catch (IOException e) {
e.printStackTrace();
} |