< prev index next >

src/java.base/windows/classes/sun/nio/fs/WindowsFileStore.java

Print this page

        

*** 123,154 **** public boolean isReadOnly() { return ((volInfo.flags() & FILE_READ_ONLY_VOLUME) != 0); } // read the free space info ! private DiskFreeSpace readDiskFreeSpace() throws IOException { try { return GetDiskFreeSpaceEx(root); } catch (WindowsException x) { x.rethrowAsIOException(root); return null; } } @Override public long getTotalSpace() throws IOException { ! return readDiskFreeSpace().totalNumberOfBytes(); } @Override public long getUsableSpace() throws IOException { ! return readDiskFreeSpace().freeBytesAvailable(); } @Override public long getUnallocatedSpace() throws IOException { ! return readDiskFreeSpace().freeBytesAvailable(); } @Override public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) { if (type == null) --- 123,168 ---- public boolean isReadOnly() { return ((volInfo.flags() & FILE_READ_ONLY_VOLUME) != 0); } // read the free space info ! private DiskFreeSpace readDiskFreeSpaceEx() throws IOException { try { return GetDiskFreeSpaceEx(root); } catch (WindowsException x) { x.rethrowAsIOException(root); return null; } } + private DiskFreeSpace readDiskFreeSpace() throws IOException { + try { + return GetDiskFreeSpace(root); + } catch (WindowsException x) { + x.rethrowAsIOException(root); + return null; + } + } + @Override public long getTotalSpace() throws IOException { ! return readDiskFreeSpaceEx().totalNumberOfBytes(); } @Override public long getUsableSpace() throws IOException { ! return readDiskFreeSpaceEx().freeBytesAvailable(); ! } ! ! @Override ! public int getBlockSize() throws IOException { ! return (int)readDiskFreeSpace().bytesPerSector(); } @Override public long getUnallocatedSpace() throws IOException { ! return readDiskFreeSpaceEx().freeBytesAvailable(); } @Override public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) { if (type == null)
*** 163,172 **** --- 177,188 ---- return getTotalSpace(); if (attribute.equals("usableSpace")) return getUsableSpace(); if (attribute.equals("unallocatedSpace")) return getUnallocatedSpace(); + if (attribute.equals("bytesPerSector")) + return getBlockSize(); // windows specific for testing purposes if (attribute.equals("volume:vsn")) return volInfo.volumeSerialNumber(); if (attribute.equals("volume:isRemovable")) return volType == DRIVE_REMOVABLE;
< prev index next >