Reading a file's contents: (from
http://javaalmanac.com/egs/java.io/R...sFromFile.html)
* *try {
* * * *BufferedReader in = new BufferedReader(new FileReader("infilename"));
* * * *String str;
* * * *while ((str = in.readLine()) != null) {
* * * * * *process(str);
* * * *}
* * * *in.close();
* *} catch (IOException e) {
* *}
Read from one file and write to another: (from
http://javaalmanac.com/egs/java.io/CopyFile.html?l=new)
* *// Copies src file to dst file.
* *// If the dst file does not exist, it is created
* *void copy(File src, File dst) throws IOException {
* * * *InputStream in = new FileInputStream(src);
* * * *OutputStream out = new FileOutputStream(dst);
* *
* * * *// Transfer bytes from in to out
* * * *byte[] buf = new byte[1024];
* * * *int len;
* * * *while ((len = in.read(buf)) > 0) {
* * * * * *out.write(buf, 0, len);
* * * *}
* * * *in.close();
* * * *out.close();
* *}
hope that will help get your started. Note the classes used to read and write. You can find them in the
JavaTM 2 Platform, Standard Edition, v 1.4.2 API Specification under java.io