Code example for BufferedWriter

Methods: append, close, newLine

0
		calendar = Calendar.getInstance();
		String time = parseTime(calendar.getTimeInMillis());
	   try 
	   { 
	      //BufferedWriter for performance, true to set append to file flag 
	      BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); 
	      buf.append(time + "@ " + tag + " >>> " + text);
	      buf.newLine();
	      buf.close();
	   } 
	   catch (IOException e)
	   { 
	      // TODO Auto-generated catch block 
	      e.printStackTrace();
	   } 
	} 
	 
	public String parseTime(long t) {
		String format = "yyyy-MM-dd-HH-mm-ss";
		SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
		sdf.setTimeZone(TimeZone.getTimeZone("GMT-4"));