/ Published in: Java

Expand |
Embed | Plain Text
/** * Class to read inputs from the command line and write to files. */ class ReadWrite { /** * Reads the input from command line and returns it as a string. */ { try { str = in.readLine(); } { } return str; } /** * Reads the specified file. */ { try { String str; while ((str = in.readLine()) != null) { } data = sb.toString(); in.close(); } { } return data; } /** * Writes the specified string to the file specified. * Will overwrite file if same name is specified as an existing file. */ { try { out.write(contents.trim()); out.close(); } { } } }
You need to login to post a comment.