Application on the File (File folders can be encapsulated, etc.) to obtain information of some files

Test Package; 


Import the java.io. *; 
Import the java.text.DateFormat; 
Import the java.text.SimpleDateFormat; 
Import Classes in java.util *;. 
Import java.util.zip.InflaterInputStream; 

Import javax.annotation.processing.FilerException; 

Import privateclass.MyBufferedReader; 

public class {the main 

	Private Final static String space_operator = ""; 
	Private static Double PI = Final Math.PI; 
	Private static String LINE_SEPARATOR = Final the System.getProperty ( "line.separator, and is"); 
	public static void main (String [] args) throws Exception { 

		//File.separator partition delimiters in the delimiter is \\ windows is in the linux / 
		System.out.println (file); 
		File File = new new File ( "E:" + the File.separator + "Java compiler \\ test \\ demo.txt "); // absolute path
		//// File file = new File ( " demo.txt"); // relative path 
		System.out.println ( "Time:" + dateFormat2.format(new Date(time)));
		File.getName name = String (); 
		// remaining space 
		long free = file.getFreeSpace (); 
		the size of the file // 
		long len = file.length (); 
		last modified time of the file // 
		long time = file.lastModified (); 
		
		absolute path of the file // 
		String abspath = file.getAbsolutePath (); 
		relative path to a file // 
		String file.getPath path = (); 
		
		DateFormat the dateFormat the SimpleDateFormat new new = ( "the MM dd YYYY"); 
		DateFormat DateFormat = dateFormat2 .getDateTimeInstance (dateFormat.LONG, dateFormat.LONG); 
		System.out.println ( "name:" + name); 
		System.out.println ( "Time:" + dateFormat.format (new new a Date (Time))); 
		the System .out.println ( "Free:" Free +); 
		System.out.println ( "len:" + len);
		System.out.println("abspath:" + abspath);
		System.out.println("path:" + path);
	}
}

  

Guess you like

Origin www.cnblogs.com/WINDZLY/p/11809511.html