Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I want to write an empty line in a file. I am trying to save a String variable with the value newLine = "\n". And then trying to write it to the file using the method fileOutputStream.write(newLine.getBytes()). But the thing is i only get a black empty square rather than an empty line.
I created an object of the PrintWriter class passing the file through the constructor.
PrintWriter printWriter = new PrintWriter(outputFile);
And then when i try to write anything to the file nothing turned up.
printWriter.write(NameRemovalConstants.commentLine1); added nothing to the file.
even
PrintWriter printWriter = new PrintWriter(new FileOutputStream(outputFile,false))
I have modified the code after a little googling and now i have changed the print writer object to
PrintWriter printWriter = new PrintWriter(new FileWriter(outputFile));
But when i am writing to the file i keep getting the empty blank squares.
printWriter.println(ServiceRemovalConstants.commentLine1);
Only this time not at the end of the line but at the beginning.
He baked a muffin that stole my car! And this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth