List of usage examples for java.nio.file FileSystems getDefault
public static FileSystem getDefault()
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { boolean compression = (Boolean) store.getAttribute("zfs:compression"); }//from w w w . j av a 2s . c o m }
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { long total = store.getTotalSpace() / 1024; System.out.println(total); }/*from ww w. j av a 2s.c o m*/ }
From source file:Main.java
public static void main(String[] args) throws IOException { FileSystem fileSystem = FileSystems.getDefault(); for (FileStore store : fileSystem.getFileStores()) { long total = store.getUnallocatedSpace() / 1024; System.out.println(total); }/*from w w w . j a v a2 s . c o m*/ }
From source file:Test.java
public static void main(String[] args) throws Exception { Path newFile = FileSystems.getDefault().getPath("C:/h.html"); URI url = URI.create("http://jdk7.java.net/"); InputStream inputStream = url.toURL().openStream(); Files.copy(inputStream, newFile); System.out.println("Site copied successfully!"); }
From source file:Main.java
public static void main(String[] args) { //list all the supported views in the current file system FileSystem fs = FileSystems.getDefault(); Set<String> views = fs.supportedFileAttributeViews(); for (String view : views) { System.out.println(view); }/*from ww w .jav a2 s .co m*/ }
From source file:Main.java
public static void main(String[] args) { String globPattern = "glob:**txt"; PathMatcher matcher = FileSystems.getDefault().getPathMatcher(globPattern); Path path = Paths.get("C:\\Java_Dev\\test1.txt"); boolean matched = matcher.matches(path); System.out.format("%s matches %s: %b%n", globPattern, path, matched); }
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(); }//from w w w .j a va2 s.c o m }
From source file:Test.java
public static void main(String[] args) throws Exception { Path path = FileSystems.getDefault().getPath("./file2.log"); System.out.println("File Size:" + Files.size(path)); System.out.println("Is Directory:" + Files.isDirectory(path)); System.out.println("Is Regular File:" + Files.isRegularFile(path)); System.out.println("Is Symbolic Link:" + Files.isSymbolicLink(path)); System.out.println("Is Hidden:" + Files.isHidden(path)); System.out.println("Last Modified Time:" + Files.getLastModifiedTime(path)); System.out.println("Owner:" + Files.getOwner(path)); DosFileAttributeView view = Files.getFileAttributeView(path, DosFileAttributeView.class); System.out.println("Archive :" + view.readAttributes().isArchive()); System.out.println("Hidden :" + view.readAttributes().isHidden()); System.out.println("Read-only:" + view.readAttributes().isReadOnly()); System.out.println("System :" + view.readAttributes().isSystem()); view.setHidden(false);/*from www .java2 s . c om*/ }
From source file:Main.java
public static void main(String[] args) { FileSystem fs = FileSystems.getDefault(); System.out.println("Read-only file system: " + fs.isReadOnly()); System.out.println("File name separator: " + fs.getSeparator()); for (FileStore store : fs.getFileStores()) { printDetails(store);//from ww w . j a v a 2 s. co m } for (Path root : fs.getRootDirectories()) { System.out.println(root); } }
From source file:Main.java
public static void main(String[] args) throws IOException { final Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp/"); final String tmp_dir_prefix = "Swing_"; final Path tmp_dir = Files.createTempDirectory(basedir, tmp_dir_prefix); }