List of usage examples for java.nio.file FileStore name
public abstract String name();
From source file:Main.java
public static void main(String[] args) { FileSystem fileSystem = FileSystems.getDefault(); FileSystemProvider provider = fileSystem.provider(); Iterable<FileStore> fileStores = fileSystem.getFileStores(); System.out.println();/*from ww w . j a v a2 s . co m*/ System.out.println("File Stores"); for (FileStore fileStore : fileStores) { System.out.println(fileStore.name()); } }
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { System.out.println(store.name()); }/*w w w. ja v a 2 s . c om*/ }
From source file:Test.java
public static void main(String[] args) { FileSystem fileSystem = FileSystems.getDefault(); FileSystemProvider provider = fileSystem.provider(); System.out.println("Provider: " + provider.toString()); System.out.println("Open: " + fileSystem.isOpen()); System.out.println("Read Only: " + fileSystem.isReadOnly()); Iterable<Path> rootDirectories = fileSystem.getRootDirectories(); System.out.println();/*from www. j av a 2 s .co m*/ System.out.println("Root Directories"); for (Path path : rootDirectories) { System.out.println(path); } Iterable<FileStore> fileStores = fileSystem.getFileStores(); System.out.println(); System.out.println("File Stores"); for (FileStore fileStore : fileStores) { System.out.println(fileStore.name()); } }
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { boolean supported = store.supportsFileAttributeView("basic"); System.out.println(store.name() + " ---" + supported); }//from ww w. j av a2s. com }
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { boolean supported = store.supportsFileAttributeView(BasicFileAttributeView.class); System.out.println(store.name() + " ---" + supported); }//from ww w . ja v a 2s.com }
From source file:Test.java
public static void main(String[] args) throws Exception { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore fileStore : fileSystem.getFileStores()) { long totalSpace = fileStore.getTotalSpace() / kiloByte; long usedSpace = (fileStore.getTotalSpace() - fileStore.getUnallocatedSpace()) / kiloByte; long usableSpace = fileStore.getUsableSpace() / kiloByte; String name = fileStore.name(); String type = fileStore.type(); boolean readOnly = fileStore.isReadOnly(); }// w w w. j a v a2s .c o m }
From source file:alluxio.cli.validation.StorageSpaceValidationTask.java
private boolean addDirectoryInfo(String path, long quota, Map<String, MountedStorage> storageMap) throws IOException { File file = new File(path); if (!file.exists()) { System.err.format("Path %s does not exist.%n", path); return false; }/*w w w. ja v a 2 s . c o m*/ if (!file.isDirectory()) { System.err.format("Path %s is not a valid directory.%n", path); return false; } long directorySize = FileUtils.sizeOfDirectory(file); // gets mounted FileStore that backs the directory of the given path FileStore store = Files.getFileStore(Paths.get(path)); MountedStorage storage = storageMap.get(store.name()); if (storage == null) { storage = new MountedStorage(store); storageMap.put(store.name(), storage); } storage.addDirectoryInfo(path, quota, directorySize); return true; }
From source file:fr.ortolang.diffusion.store.binary.BinaryStoreServiceBean.java
@Override @TransactionAttribute(TransactionAttributeType.SUPPORTS) public List<BinaryStoreContent> systemBrowse(String name, String prefix) throws BinaryStoreServiceException { if (name == null || name.length() == 0) { List<BinaryStoreContent> vinfos = new ArrayList<BinaryStoreContent>(); List<String> vnames = new ArrayList<String>(); vnames.addAll(BinaryStoreVolumeMapper.listVolumes()); vnames.add(WORK);/*from w w w .j a v a 2 s. co m*/ for (String vname : vnames) { try { BinaryStoreContent volume = new BinaryStoreContent(); Path vpath = Paths.get(base.toString(), vname); FileStore vstore = Files.getFileStore(vpath); volume.setPath(vname); volume.setType(Type.VOLUME); volume.setFsName(vstore.name()); volume.setFsType(vstore.type()); volume.setFsTotalSize(vstore.getTotalSpace()); volume.setFsFreeSize(vstore.getUsableSpace()); volume.setSize(Files.size(vpath)); volume.setLastModificationDate(Files.getLastModifiedTime(vpath).toMillis()); vinfos.add(volume); } catch (IOException e) { LOGGER.log(Level.WARNING, "Unable to retrieve binary store volume information for volume: " + vname); } } return vinfos; } else { try { if (prefix == null) { prefix = ""; } Path vpath = Paths.get(base.toString(), name, prefix); if (!Files.exists(vpath)) { throw new BinaryStoreServiceException( "volume name does not point to an existing file or a directory"); } return Files.list(vpath).map(this::pathToContent).collect(Collectors.toList()); } catch (IOException e) { throw new BinaryStoreServiceException(e); } } }