Any way to access fstat.st_blocks from Java (UnixFileAttributesView)
Uwe Schindler
uschindler at apache.org
Fri Jun 28 10:32:52 UTC 2019
Hi,
i browsed through the JDK source code to find a way if the allocated block size of a file can be found using any FileAttributeView. There is the hidden unix one, which allows access to most of the "st_xxxx" constants like st_size, but the st_blocks and st_blksize ones are missing. Is this intended?
The use case for this is to find the actual size allocation of a file on disk (e.g., if it's sparse or for SAMFS if its currently only on band archive (in this case the block size is 0).
Any hints to get the file size on disk from Java that uses the st_blocks and st_blksize behind the scenes?
Thanks,
Uwe
-----
Uwe Schindler
uschindler at apache.org
ASF Member, Apache Lucene PMC / Committer
Bremen, Germany
https://lucene.apache.org/
More information about the nio-dev
mailing list