Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of sparse file in java 7?

Tags:

java

java-7

In java 7 OpenOption "SPARSE" Hints that a newly created file will be sparse. What does that mean?

like image 1000
CoffeeCup Avatar asked Aug 20 '12 15:08

CoffeeCup


People also ask

What is the use of sparse file?

Sparse files are commonly used for disk images, database snapshots, log files and in scientific applications.

What is a sparse file record?

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.

How do you create a sparse file?

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.


1 Answers

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.

like image 161
Stephen C Avatar answered Sep 24 '22 23:09

Stephen C