I'm trying to create a modified version of a file by omitting certain lines from the original file if they do not meet a certain requirement. I'm not sure how to accomplish this. When I read in files, I use
BufferedReader(new FileReader(new File(...)))
I suppose I will use BufferedWriter to write out to file, but I have never used BufferedWriter before. I'm confused about the write() method. What is the difference (besides the obvious one that they take different parameters) between
write(char[] cbuf, int off, int len)
and
write(String s, int off, int len)
When should I use one vs. the other? If I want to write ONLY the lines that meet a certain requirement, will something like this work:
if(/** meets specific condition */) {
out.write(/**not sure which of the two above to use*/);
}
Or should I use another type of writer, like FileWriter?