67,538
社区成员
发帖
与我相关
我的任务
分享FilterWriter out = new FilterWriter(response.getWriter()) {
@Override
public void write(int c) throws IOException {
if (c == '\n') {
super.write('\r');
}
super.write(c);
}
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
cbuf = String.valueOf(cbuf).replace("\n", "\r\n").toCharArray();
super.write(cbuf, off, len);
}
@Override
public void write(String str, int off, int len) throws IOException {
str = str.replace("\n", "\r\n");
super.write(str, off, len);
}
};
CsvWriter wr = new CsvWriter(out, ',');