File a.txt
looks like:
ABC
File d.txt
looks like:
DEF
I'm trying to take "DEF" and append it to "ABC" so a.txt
looks like
ABC
DEF
The methods I've tried always completely overwrite the first entry so I always end up with:
DEF
Here are the two methods I've tried:
FileChannel src = new FileInputStream(dFilePath).getChannel();
FileChannel dest = new FileOutputStream(aFilePath).getChannel();
src.transferTo(dest.size(), src.size(), dest);
...and I've tried
FileChannel src = new FileInputStream(dFilePath).getChannel();
FileChannel dest = new FileOutputStream(aFilePath).getChannel();
dest.transferFrom(src, dest.size(), src.size());
The API is unclear about the transferTo and transferFrom param descriptions here:
http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html#transferTo(long, long, java.nio.channels.WritableByteChannel)
Thanks for any ideas.