In java 7 OpenOption "SPARSE" Hints that a newly created file will be sparse. What does that mean?
Sparse files are commonly used for disk images, database snapshots, log files and in scientific applications.
A file format that saves storage space by recording only actual data. Whereas regular files record empty fields as blank data or runs of nulls, a sparse file includes meta-data that describe where the runs of non-data are located.
Windows provides command line program named fsutilI (File system utility) which allows for creation/allocation/query of sparse files. To create sparse file on windows, execute the following command on command interpreter (cmd. The above command creates new file (filled with zeros) under name of applese.
A sparse file is one in which contiguous sections of the file that are all zeros may not be allocated disc blocks. It is a way of saving disk space if you intend to create a file that will have large "holes" in it. For more background, refer to this Wikipedia article - http://en.wikipedia.org/wiki/Sparse_file
As Joachim notes, many kinds of file system on many operating systems support sparse files, and have done for many years. Java 7 is simply making this functionality available for Java applications to use ... where available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With