title: JAVA: IO Exception: Reason Stream closed
body: <p>Why am I getting the following exception? What I am doing is writing a giant ArrayList line by line to a file onto the disk. The file generated is about >700MB.
  It seems like it has some problem when written line by line. Could the size of the file a reason? Why is the stream closed? By the way, I am working on a Windows OS.</p>
  
  <pre><code>FileWriter evaluated_result = 
      new FileWriter(path_output+this.algorithm+"/"+query_type+"/"+"queries.eval");
  BufferedWriter out = new BufferedWriter(evaluated_result);
  out.write(Myobject);
  out.newLine();
  evaluated_result.close();
  out.close();
  </code></pre>
  
  <p>The exception is as follows:</p>
  
  <pre><code>java.io.IOException: Stream closed
      at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:45)
      at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:118)
      at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
      at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
      at java.io.BufferedWriter.close(BufferedWriter.java:264)
      at Assignment_1.Query_Evaluator.write100BestDocumentsEvalFormat(Query_Evaluator.java:85)
      at Assignment_1.Experiment.ConductExperiment(Experiment.java:54)
      at Assignment_1.Main.main(Main.java:78)
  </code></pre>