sparse-file

android - pre-allocate space for a file before downloading it

前提是你 提交于 2019-12-06 05:44:47
how can i create a pre-allocated file on android? something like a sparse file ? i need to make an applicaton that will download a large file , and i want to avoid having an out-of-space error while the download is commencing . my solution needs to support resuming and writing to both internal and external storage. i've tried what is written here: Create file with given size in Java but for some reason, none of those solutions worked. this is odd. it works fine now . perhaps i've tested it in a wrong way. here's a working code , for those who have problems with it : final String path

Copying a 1TB sparse file

时光怂恿深爱的人放手 提交于 2019-11-30 03:28:01
I got a sparse file of 1TB which stores actually 32MB data on Linux. Is it possible to "efficiently" make a package to store the sparse file? The package should be unpacked to be a 1TB sparse file on another computer. Ideally, the "package" should be around 32MB. Note: On possible solution is to use 'tar': https://wiki.archlinux.org/index.php/Sparse_file#Archiving_with_.60tar.27 However, for a 1TB sparse file, although the tar ball may be small, archiving the sparse file will take too long a time. Edit 1 I tested the tar and gzip and the results are as follows (Note that this sparse file

How to create a sparse file on NTFS?

筅森魡賤 提交于 2019-11-30 02:51:10
问题 I'm testing a sparse file. But my test code doesn't work well. HANDLE h = CreateFileW(L"D:\\sparse.test", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_SPARSE_FILE, 0); DWORD d = GetFileAttributes(L"D:\\sparse.test"); // The function returns 32(FILE_ATTRIBUTE_ARCHIVE). // Where is FILE_ATTRIBUTE_SPARSE_FILE flag? // How do I make a sparse file. DWORD written; WriteFile(h, "aaa", 3, &written, 0);