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
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