| Код | InputStream source = new BufferedInputStream(new FileInputStream(sourceName)); OutputStream copy = new BufferedOutputStream(new FileOutputStream(copyName)); while (true) { int b = source.read(); if (b < 0) break; copy.write(b); } source.close(); copy.close();
|
Добавлено @ 09:56 Можно еще так. Какой способ быстрее не скажу.
| Код | FileChannel sourceChannel = new FileInputStream("source").getChannel(); FileChannel copyChannel = new FileOutputStream("copy").getChannel(); copyChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); sourceChannel.close(); copyChannel.close();
|
|