test1.java
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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+"");
// }
}
}