先读到内存中去(如果过大,可以分批),然后,查找“/*”。“*/”的位置,注意是一对一对的,然后分对cut,再另存,读下一批,或者下一个文件.
要在首个"/*"的地址开始下一批的导入。

解决方案 »

  1.   

    比如我读入一个文件,然后用StringTokenizer把它分割后打印出来,我该怎样写读入文件这段程序?
      

  2.   

    try{
    DataInputStream in=new DataInputStream(
    new BufferedInputStream(
    new FileInputStream("test.java")));
    String s,s2=new String();

    while((s=in.readLine())!=null){
        s2=s2+s+"\n";
    }
    in.close();
    }catch(Exception e){System.out.println(e);}
      

  3.   

    我用RandomAccessFile fileIn=new RandomAccessFile(myfile,"rw");读入一个文件,我想把此文件的所有内容放入一个String中,我该如何做?
      

  4.   

    try{
        RandomAccessFile fileIn=new RandomAccessFile(myfile,"rw");
        String s;
        StringBuffer buf = new StringBuffer();
        while((s=in.readLine())!=null)
           buf.append(s+"\n");
        
        fileIn.close();
    }catch(IOException e){
        e.printStackTrace();
    }