txt 下载换行代码-已测试

来源:互联网 发布:资本主义灭亡 知乎 编辑:程序博客网 时间:2024/04/29 08:36
  File file = new File("xxx/share.txt");
       
        InputStreamReader read = new InputStreamReader(new FileInputStream(file),"GBK");
        BufferedReader readBuf = new BufferedReader(read);
        String s = null;
        os = response.getOutputStream();
        byte[] c=new byte[2];
        c[0]=0x0d;
        c[1]=0x0a;
        while((s=readBuf.readLine())!=null){
        os.write(s.getBytes(), 0, s.getBytes().length);
        os.write(c, 0, 2);
            os.flush(); 
        }
        readBuf.close();
        os.close();


txt内容

卡号,金额
001,0

2
3
1
21
2
1
2121

0 0
原创粉丝点击