title: Opening an existing file in Java and closing it.
body: <p>Is it possible to open a file a in java append data and close numerous times. For example:</p>
  
  <pre><code> //---- psuedocode
        //class variable declaration 
        FileWriter writer1 = new FileWriter(filename);
  
        fn1:
  
           writer.append(data - title);
  
        fn2:
         while(incomingdata == true){
           writer.append(data)
           writer.flush();
           writer.close()
          }
  </code></pre>
  
  <p>The problem lies in the while loop. The file is closed and cant be opened again. Any one can help me in this?</p>