I've looked at java.nio.file.attribute.Attributes
and java.nio.file.FileStore
, but couldn't find a way to discover the block-size of a disk-file.
Here is an article on buffer size vs I/O throughput. Synopsis: nio handles all of that for you. This SO post concludes you should use a power of 2.
Java 7 does not have the requested information, and the users question is related to Java 7.
But in Java 10, there was a new method introduced which provides the requested information.
The getBlockSize() method of a FileStore class is used to return the number of bytes per block in this file store Object. Every File storage is organized into discrete sequences of bytes called blocks and a block is the smallest storage unit of a file store. Every read and write operation is performed on multiple blocks. This method is helpful in getting the size of Block.
© 2022 - 2024 — McMap. All rights reserved.