现在有个卡号表 表中有二十几的字段 账号 密码 等等从数据库里取出五万条记录 然后取出 账号 密码放在记事本里结果内存溢出 哎 怎么办啊?  谢谢大家

解决方案 »

  1.   

    public static boolean stringFile(String rss, String filePath) throws UnsupportedEncodingException {   
    try {
    File distFile = new File(filePath);
        Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(distFile), "UTF8"));
            out.write(rss);
            out.close();
        } catch (UnsupportedEncodingException e) {
         return false;
        } catch (IOException e) {
         return false;
        } 
        return true;
        }
    大家看看 这个函数 可以将字符串写入记事本里, 如果记事本里已经有文件将会覆盖,不知道怎么弄才能够使继续在记事本后面添加呢
      

  2.   

    我记得好像是有个方法接着添加到后面的
    现在不太记得了
    好久没用了
    呵呵 你可以查查JDK
      

  3.   

    汗的,看来你J2SE基础没学好啊,java流都用不熟练,哎,,去API查查这个类的用法RandomAccessFile
    相信你很快就会搞定的,嘿嘿
      

  4.   

    用这个RandomAccessFile也行 呵呵不过答案是这个:public static boolean stringFile(String rss, String filePath) throws UnsupportedEncodingException {   
    try {
    File distFile = new File(filePath);
        Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(distFile,true), "UTF8"));
            out.write(rss);
            out.close();
        } catch (UnsupportedEncodingException e) {
         return false;
        } catch (IOException e) {
         return false;
        } 
        return true;
        }