Here is an example where I read lines from a file as strings to make a whole file as an array of strings:
String[] ArrayOfStrings = (new Scanner( new File("log.txt") ).useDelimiter("\\A").next()).split("[\\r\\n]+");
I there any similar way to do the write back into the file:
something_that_writes_into_file(ArrayOfStrings)?
I know about PrintWriter
, Buffer
and other stuffs using loops.
My question is specifically about something which is more compact, say - a one line solution?