java.nio.file.FileStore#getUnallocatedSpace ( )源码实例Demo

下面列出了java.nio.file.FileStore#getUnallocatedSpace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cyberduck   文件: LocalQuotaFeature.java
@Override
public Space get() throws BackgroundException {
    final Path home = new DefaultHomeFinderService(session).find();
    try {
        final FileStore store = Files.getFileStore(session.toPath(home));
        return new Space(store.getTotalSpace() - store.getUnallocatedSpace(), store.getUnallocatedSpace());
    }
    catch(IOException e) {
        throw new LocalExceptionMappingService().map("Failure to read attributes of {0}", e, home);
    }
}
 
源代码2 项目: packagedrone   文件: ConfigController.java
private Double freeSpace ()
{
    try
    {
        final String base = System.getProperty ( SYSPROP_STORAGE_BASE );
        final Path p = Paths.get ( base );

        final FileStore store = Files.getFileStore ( p );
        return (double)store.getUnallocatedSpace () / (double)store.getTotalSpace ();
    }
    catch ( final Exception e )
    {
        return null;
    }
}
 
源代码3 项目: spliceengine   文件: FileSystemConfiguration.java
public long unallocatedBytes() throws IOException {
    Iterable<FileStore> fileStores = localFileSystem.getFileStores();
    long totalUsableSpace = 0l;
    for(FileStore fs:fileStores){
        totalUsableSpace+=fs.getUnallocatedSpace();
    }
    return totalUsableSpace;
}
 
源代码4 项目: levelup-java-examples   文件: GetUsedSpace.java
@Test
public void get_used_space_nio () throws IOException {

	FileStore store = Files.getFileStore(source);

	long usedSpace = (store.getTotalSpace() -
             store.getUnallocatedSpace()) / 1024;
	
	assertTrue(usedSpace > 0);
}