コード例 #1
0
 // To be called by the creating method after all parsing is complete.
 public void finishWriting() {
   try {
     fileWriter.flush();
     fileWriter.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
 // Created each time there is a new run.
 // Outputs a single CSV file that should have a unique name based on system time.
 // Each call of process will write all citation needed tags to the file created
 // for the run.
 public MyPageCallbackHandler(String fileName) {
   Calendar cal = Calendar.getInstance();
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z");
   fileName = sdf.format(cal.getTime()) + "." + fileName + ".csv";
   try {
     fileWriter = new FileWriter(fileName, true);
     fileWriter.append(FILE_HEADER);
     fileWriter.append(NEW_LINE_SEPARATOR);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }