The following very quickly creates large files filled with zeros. (This sample is in Scala but only the Java API is used)
val f = new File(dir, fileName)
val raf = new RandomAccessFile(f, "rw")
raf.setLength(8 * math.pow(math.pow(2, 16), 2).toLong)
raf.close()
What is a quick way to fill the file with the integer value -1 (0xffffffff
)?
User contributions licensed under CC BY-SA 3.0