一、代码如下
package www.tainiu.wenjian;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class aa__FileZiJieLiu__V1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//File f= new File("d:\Test.txt");
FileInputStream fis= null;
try {
//fis= new FileInputStream(f);
fis= new FileInputStream("d:\Test.txt");
byte[] bytes= new byte[1024];
int n= 0;
while((n=fis.read(bytes)) != -1) {
String s= new String(bytes, 0, n);
s= new String(bytes, "GBK");
System.out.println(s);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {fis.close();} catch (IOException e) {e.printStackTrace();}
}
}
}