我们正在从Web服务流式传输CSV文件.看来我们在流式传输时丢失了新行字符 - 客户端将文件全部放在一行上.知道我们做错了什么吗?
码:
public static void writeFile(OutputStream out, File file) throws IOException {
BufferedReader input = new BufferedReader(new FileReader(file)); //File input stream
String line;
while ((line = input.readLine()) != null) { //Read file
out.write(line.getBytes()); //Write to output stream
out.flush();
}
input.close();
}
Run Code Online (Sandbox Code Playgroud)