test1.java 1.4 KB
package test;

//import java.io.BufferedInputStream;
//import java.io.BufferedReader;
import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.FileReader;
//import java.io.FileWriter;
import java.io.IOException;
//import java.io.InputStreamReader;

public class test1 {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		File file=new File("F:\\sh");//获得这个文件的对象
		for(int i=0;i<file.list().length;i++)
			System.out.println(file.list()[i]);
//		file.delete();
//		file.createNewFile();
//		FileOutputStream fo=new FileOutputStream(file);
//		FileWriter writer = new FileWriter(file, false); 
//		writer.write("哈哈哈");
//		writer.close();  
//		FileInputStream fr=new FileInputStream(file);//文件的输入流对象
		//FileInputStream fr=new FileInputStream("F:\\test.txt");
//		BufferedInputStream bf=new BufferedInputStream(fr);
//		FileReader fin=new FileReader(file);
//		InputStreamReader is=new InputStreamReader(fr,"utf-8");
//		System.out.println(bf);
//		BufferedReader bf2=new BufferedReader(is);
//		String line;
//		while((line=bf2.readLine())!=null){
//		System.out.println(line);/
//		}
//		int i=-1;
//		while((i=is.read())!=-1){
//		System.out.println((char)+i+"");
//		}

	}

}