package chap10.sec03;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class Demo3 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file =new File("D:/测试文件.txt");
InputStream in=new FileInputStream(file);//实例化FileInputStream
int fileLength=(int)file.length();
byte b[]=new byte[fileLength];
int length=in.read(b);
in.close();
System.out.println("读取到的内容是:"+new String(b));
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
public class Demo3 {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
File file =new File("D:/测试文件.txt");
InputStream in=new FileInputStream(file);//实例化FileInputStream
int fileLength=(int)file.length();
byte b[]=new byte[fileLength];
int length=in.read(b);
in.close();
System.out.println("读取到的内容是:"+new String(b));
}
}