应该不是路径的问题,我的别的程序都可以通过的,可能是我的fileReader的方法用错了,
请问怎么样可以用fileReader()把数据从文件中导入?
谢谢各位了~~!!!!

解决方案 »

  1.   

    import java.io.*;public class IODemo{
      public static void main(String[] args) throws IOException{
        BufferedReader in=new BufferedReader(new FileReader("page1.htm"));//文件路径
        String s,s2=new String();
        char c;
        while((s=in.readLine())!=null)
          s2+=s+"\n";
        in.close();
        s2 = new String( s2.getBytes( "ISO8859_1"));
        try{
          DataInputStream in2=new DataInputStream(new ByteArrayInputStream(s2.getBytes()));
          while(true){
            c=(char)in2.readByte();
            System.out.print(c);
          }
        }
        catch(EOFException e){
          System.err.println("End of stream");
        }
      }
    }