import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class ReadPrime {
public void readPrime(String path){
File file=new File(path);
int b;
if(!file.exists())
try{
throw new Exception("文件不存在");
}
catch(Exception e){
e.printStackTrace();
}
FileInputStream in;
try{
in= new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(in);
while((b=bis.read())!=-1){
System.out.print((char)b);
}
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
}
public static void main(String[] args) {
ReadPrime rp=new ReadPrime();
rp.readPrime("D:\\prime.dat");
}
}