![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e172. Copying One File to Anothertry { // Create channel on the source FileChannel srcChannel = new FileInputStream("srcFilename").getChannel(); // Create channel on the destination FileChannel dstChannel = new FileOutputStream("dstFilename").getChannel(); // Copy file contents from source to destination dstChannel.transferFrom(srcChannel, 0, srcChannel.size()); // Close the channels srcChannel.close(); dstChannel.close(); } catch (IOException e) { }
e167. Persisting Changes to a Memory-Mapped ByteBuffer e168. Determining If a ByteBuffer Is Direct e169. Reading from a Channel with a ByteBuffer e170. Writing to a Channel with a ByteBuffer e171. Writing and Appending a ByteBuffer to a File
© 2002 Addison-Wesley. |