Example usage for java.nio.file FileSystems getDefault

List of usage examples for java.nio.file FileSystems getDefault

Introduction

In this page you can find the example usage for java.nio.file FileSystems getDefault.

Prototype

public static FileSystem getDefault() 

Source Link

Document

Returns the default FileSystem .

Usage

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();

    Path path = fileSystem.getPath("c:/abc/");
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String separator;/*from w w w  .j a v a 2s .  c  o  m*/
    separator = FileSystems.getDefault().getSeparator();
    System.out.println("The separator is " + separator);

}

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();
    PathMatcher matcher = fileSystem.getPathMatcher("glob:java?.exe");
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    FileSystem fileSystem = FileSystems.getDefault();

    Iterable<Path> dirs = fileSystem.getRootDirectories();
    for (Path name : dirs) {
        System.out.println(name);
    }/*from w ww  .j  a v a2  s . c o  m*/
    fileSystem.close();
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path sourceFile = FileSystems.getDefault().getPath("C:/home/docs/users.txt");
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    Files.copy(sourceFile, outputStream);
    byte arr[] = outputStream.toByteArray();
    System.out.println("The contents of " + sourceFile.getFileName());
    for (byte data : arr) {
        System.out.print((char) data);
    }/* ww w . j  a v a  2  s .co  m*/

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Path newFile = FileSystems.getDefault().getPath("C:/home/docs/newFile.txt");
    Path copiedFile = FileSystems.getDefault().getPath("C:/home/docs/copiedFile.txt");

    Files.createFile(newFile);/*  w  w  w  .  j  a  va  2  s .c  o m*/
    System.out.println("File created successfully!");
    Files.copy(newFile, copiedFile);
    System.out.println("File copied successfully!");
    Files.copy(newFile, copiedFile, StandardCopyOption.REPLACE_EXISTING);

}

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.isReadOnly());
    }/*  w  w  w . jav  a2s  .  co  m*/
}

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.type());
    }/*from  w w  w. j a  v  a 2s.  co m*/
}

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());
    }// ww  w.  ja  v  a 2  s .  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()) {
        System.out.println(store.getUsableSpace());
    }//w  w  w  . j a v a 2 s.  c  o  m
}