title: Delete the content of csv file in Java
body: <p>Every day I update a csv file using a <code>FileWriter</code>. When we step into a new month I have to delete the data from the previous month. My below code only updates a data in a csv file so, please help in deleting the previous month's data. </p>
  
  <p>At least I need to know how to delete the data in csv file using <code>FileWriter</code>, so that I can manage to code for deleting previous month data.</p>
  
  <pre><code>        private static void eventsUpdate(HttpServletRequest request,
                                           HttpServletResponse response)  {
              String date=request.getParameter("date");   //getting from jsp page 
              String event=request.getParameter("event"); //getting from jsp page
  
  
              File file = new File( "D:///events/events.csv");  
              if ( !file.exists() )
                  file.createNewFile();
  
              FileWriter fw = new FileWriter(file,true);
              BufferedWriter writer = new BufferedWriter( fw );
              writer.write(date);
              writer.write(",");
              writer.write(event);
  
              System.out.println("writing into excel");
              writer.newLine();
              writer.close();
              fw.close();
  
          }
  </code></pre>