List of usage examples for java.io File File
public File(URI uri)
From source file:Main.java
public static void main(String[] args) { File file = new File(File.separator + "Java" + File.separator + "folder"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); }
From source file:MainClass.java
public static void main(String[] a) { File myFile = new File("C:" + File.separator); System.out.println(myFile.length()); }
From source file:Main.java
public static void main(String[] args) { File file = new File("C:/File/demo.txt"); System.out.println(file.setReadOnly()); System.out.println(file.canWrite()); }
From source file:MainClass.java
public static void main(String[] a) { File file = new File("c:\\text.txt"); file.setReadOnly();//from ww w . j a v a 2 s . c o m System.out.println(file.canRead()); }
From source file:MainClass.java
public static void main(String[] a) { File file = new File("c:\\test\\test.txt"); boolean success = file.delete(); System.out.println(success);/*from w w w . ja v a2s .c o m*/ }
From source file:Main.java
public static void main(String[] args) { File file = new File("C:/demo.txt"); File fileParent = file.getParentFile(); System.out.println("Parent directory: " + fileParent.getPath()); }
From source file:Main.java
public static void main(String[] args) { File file = new File("C://FileIO/ExistsDemo.txt"); System.out.println(file.exists()); }
From source file:Main.java
public static void main(String[] args) { File aFile = new File("c:/a.htm"); System.out.println(aFile.length()); }
From source file:Main.java
public static void main(String[] args) { File f = new File("test.txt"); String str = f.toString();//from w w w . j a va 2 s .c o m System.out.println("pathname string: " + str); }
From source file:MainClass.java
public static void main(String[] a) { File myFile = new File("C:" + File.separator); for (String s : myFile.list()) { System.out.println(s);/* w ww . java 2 s . co m*/ } }