Bufferedwriter works, but file empty?

前端 未结 4 703
忘掉有多难
忘掉有多难 2020-12-11 08:58

I have the following code:

CSVmaker(LinkedList data) {
    String [] myLines = makeStrings(data);
  //  for (int k = 0; k

        
4条回答
  •  旧巷少年郎
    2020-12-11 09:49

    You never flush the buffer, or close the BufferedWriter.

    After the for loop, make the following calls:

    buff.flush();
    buff.close();
    

    Even with other resources, closing them when done is a good idea.

提交回复
热议问题