Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ public long getUnallocatedSpace() throws IOException {
return disk.getUnallocatedSpace();
}

@SuppressWarnings("MissingOverride") // FileStore.getBlockSize() is Java 10+
public long getBlockSize() throws IOException {
state.checkOpen();
return disk.blockSize();
}

@Override
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
state.checkOpen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ public void testFileSystemForCustomConfiguration() throws IOException {
assertThat(fs.supportedFileAttributeViews()).containsExactly("basic", "owner", "posix", "unix");

Files.createFile(fs.getPath("/foo"));
assertThat(((JimfsFileStore) Iterables.getOnlyElement(fs.getFileStores())).getBlockSize())
.isEqualTo(10);
assertThat(Files.getAttribute(fs.getPath("/foo"), "posix:permissions"))
.isEqualTo(PosixFilePermissions.fromString("---------"));
assertThat(Files.getAttribute(fs.getPath("/foo"), "creationTime"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public void testFileStore() throws IOException {

long totalSpace = 1024 * 1024 * 1024; // 1 GB
assertThat(fileStore.getTotalSpace()).isEqualTo(totalSpace);
// Default unix block size; FileStore.getBlockSize() is Java 10+, so call the Jimfs method
// directly (same package) so this still compiles on Java 8.
assertThat(((JimfsFileStore) fileStore).getBlockSize()).isEqualTo(8192);
assertThat(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace);
assertThat(fileStore.getUsableSpace()).isEqualTo(totalSpace);

Expand Down