List of utility methods to do FileChannel Copy
void | copyFile(File sourceFile, File destFile) Faster copying method from http://www.javalobby.org/java/forums/t17036.html if (!destFile.exists()) { destFile.createNewFile(); try (FileChannel source = new FileInputStream(sourceFile).getChannel(); FileChannel destination = new FileOutputStream(destFile).getChannel()) { destination.transferFrom(source, 0, source.size()); } catch (Exception e) { System.out.println(e); ... |
void | copyFile(File sourceFile, File destFile) copy File if (sourceFile.exists()) { System.out.println(sourceFile.getAbsolutePath() + " exists"); System.out.println("Is directory = " + sourceFile.isDirectory()); System.out.println("Can read = " + sourceFile.canRead()); if (!destFile.exists()) { destFile.createNewFile(); FileChannel source = null; FileChannel destination = null; try { FileInputStream inStream = new FileInputStream(sourceFile); source = inStream.getChannel(); destination = new FileOutputStream(destFile).getChannel(); destination.transferFrom(source, 0, source.size()); } finally { if (source != null) { source.close(); if (destination != null) { destination.close(); |
void | copyFile(File sourceFile, File destFile) copy File if (!destFile.exists()) { destFile.createNewFile(); FileInputStream fIn = null; FileOutputStream fOut = null; FileChannel source = null; FileChannel destination = null; try { ... |
void | copyFile(File sourceFile, File destFile) Copies a file FileChannel source = null; FileChannel destination = null; try { source = new FileInputStream(sourceFile).getChannel(); destination = new FileOutputStream(destFile).getChannel(); destination.transferFrom(source, 0, source.size()); } finally { if (source != null) { ... |
void | copyFile(File sourceFile, File destFile) (Copied from stackoverflow). if (!destFile.exists()) { destFile.createNewFile(); FileChannel source = null; FileChannel destination = null; try { source = new FileInputStream(sourceFile).getChannel(); destination = new FileOutputStream(destFile).getChannel(); ... |
void | copyFile(File sourceFile, File destFile) Copy file from a path to another. if (!destFile.exists()) { destFile.createNewFile(); FileInputStream fin = new FileInputStream(sourceFile); try { FileOutputStream fout = new FileOutputStream(destFile); try { FileChannel source = fin.getChannel(); ... |
boolean | copyFile(File sourceFile, File destFile) Copies a single file from one location to another if (!destFile.exists()) { try { destFile.createNewFile(); } catch (IOException e) { return false; FileChannel source = null; ... |
void | copyFile(File sourceFile, File destinationFile) copy File copyFile(sourceFile, destinationFile, true); |
void | copyFile(File sourceFile, File destinationFile) Copy file. FileInputStream sourceIs = null; FileChannel source = null; FileOutputStream destinationOs = null; FileChannel destination = null; try { sourceIs = new FileInputStream(sourceFile); source = sourceIs.getChannel(); destinationOs = new FileOutputStream(destinationFile); ... |
void | copyFile(File sourceFile, File destinationFile) copy File copyFile(sourceFile, destinationFile, true); |