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 Exception { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); System.out.println(Files.getLastModifiedTime(path, LinkOption.NOFOLLOW_LINKS)); }
From source file:Main.java
public static void main(String[] args) throws Exception { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); System.out.println(Files.notExists(path, LinkOption.NOFOLLOW_LINKS)); }
From source file:Main.java
public static void main(String[] args) throws Exception { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); System.out.println(Files.isSymbolicLink(path)); }
From source file:Main.java
public static void main(String[] args) throws Exception { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); System.out.println(Files.size(path)); }
From source file:Main.java
public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(FileSystems.getDefault().getPath("logs", "access.log")); System.out.println(scanner.nextLine()); scanner.close();// w ww. ja v a 2 s .c om }
From source file:Main.java
public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(FileSystems.getDefault().getPath("logs", "access.log"), StandardCharsets.UTF_8.name()); System.out.println(scanner.nextLine()); scanner.close();// ww w . j av a2 s . c om }
From source file:Main.java
public static void main(String[] args) { Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp/"); String tmp_dir_prefix = "Swing_"; //get the default temporary folders path String default_tmp = System.getProperty("java.io.tmpdir"); System.out.println(default_tmp); try {//from w ww .java2 s . c o m //set a prefix Path tmp_2 = Files.createTempDirectory(tmp_dir_prefix); System.out.println("TMP: " + tmp_2.toString()); } catch (IOException e) { System.err.println(e); } }
From source file:Main.java
public static void main(String[] args) { Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp"); String tmp_file_prefix = "Swing_"; String tmp_file_sufix = ".txt"; //get the default temporary folders path String default_tmp = System.getProperty("java.io.tmpdir"); System.out.println(default_tmp); try {/* w ww. j ava 2 s .c om*/ //create a tmp file in a the base dir Path tmp_3 = Files.createTempFile(basedir, tmp_file_prefix, tmp_file_sufix); System.out.println("TMP: " + tmp_3.toString()); } catch (IOException e) { System.err.println(e); } }
From source file:Test.java
public static void main(String[] args) throws Exception { Path path = FileSystems.getDefault().getPath("/home/docs/users.txt"); displayFileAttributes(path);/*from ww w . j ava 2 s. co m*/ }
From source file:Main.java
public static void main(String[] args) { Path basedir = FileSystems.getDefault().getPath("C:/tutorial/tmp"); String tmp_file_prefix = "Swing_"; String tmp_file_sufix = ".txt"; //get the default temporary folders path String default_tmp = System.getProperty("java.io.tmpdir"); System.out.println(default_tmp); try {//from www .j ava 2s. c o m //set a prefix and a sufix Path tmp_2 = Files.createTempFile(tmp_file_prefix, tmp_file_sufix); System.out.println("TMP: " + tmp_2.toString()); } catch (IOException e) { System.err.println(e); } }