Hi,
I have an output file which should contain some total values from calculations, but at the end it is empty.
Here is my code in the try catch block:
BufferedWriter bwArea = new BufferedWriter(new FileWriter("." + ToolKit.fileSeparator() + OUTPUT_FILE_AREA)); bwArea.close();
in the method after that I have:
PrintWriter outArea = new PrintWriter(new BufferedWriter( new FileWriter("." + ToolKit.fileSeparator() + OUTPUT_FILE_AREA, true))); Integer total=traffic[0]+traffic[1]+traffic[2]+traffic[3]; double greenPercent = ((double)(traffic[0] )) / total*100; double yellowPercent = ((double)(traffic[1]))/total*100; double redPercent = ((double)traffic[2])/total*100; double blackPercent = ((double)traffic[3])/total*100; outArea.println("Time:" +String.valueOf(sdf.format(now.getTime()))+ " ; " + " Normal " + String.valueOf(greenPercent ) + " % " + " Moderate " + String.valueOf(yellowPercent ) + " % " + " ; " + " Severe " + String.valueOf(redPercent ) + " % " + " ; " + " Unknown " + String.valueOf(redPercent ) + " % ");
Can anybody help me please why the file is empty, what have I done wrong?
Thanks