List of utility methods to do File Copy
void | copyFile(File source, File destination) copy File Files.copy(source, destination); |
void | copyFile(File source, File destination) copy File if (!source.exists()) { return; if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) { destination.getParentFile().mkdirs(); try { ... |
void | copyFile(File source, File target) Copies source file to target file. Process p = Runtime.getRuntime().exec( new String[] { COPY_COMMAND, source.getAbsolutePath(), target.getAbsolutePath() }); try { int ret = p.waitFor(); if (ret != 0) throw new IOException("Failed to copy " + source.getAbsolutePath() + " to " ... |
void | copyFile(File sourceFile, File destFile) copy File 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 src, File dest) Copies a file to a new location preserving the file date. if (src == null) throw new NullPointerException("Source must not be null"); if (dest == null) throw new NullPointerException("Destination must not be null"); if (!src.exists()) throw new FileNotFoundException("Source '" + src + "' does not exist"); if (!src.isFile()) ... |
void | copyFile(File src, File dst) Copies one file to a specified file. File parent = dst.getParentFile(); if (!parent.exists()) { parent.mkdirs(); FileInputStream fis = null; FileOutputStream fos = null; try { int len = 0; ... |
void | copyFile(Path source, Path target) Copy a file and try to guarantee the copy is on disk. try (FileChannel in = FileChannel.open(source, READ)) { long size = in.size(); try (FileChannel out = FileChannel.open(target, WRITE, CREATE_NEW)) { long position = 0; while (position < size) { position += in.transferTo(position, size - position, out); ... |
void | copyFile(String from, String target) copy File InputStream is = ConfFileLoader.getInputStreamForFullPath(from); copyFile(is, target); |
boolean | copyFile(String from, String to) Copies one file to another return copyFile(new File(from), new File(to)); |
void | copyFile(String oldPath, String newPath) copy File try { int byteread = 0; File oldfile = new File(oldPath); if (oldfile.exists()) { InputStream inStream = new FileInputStream(oldPath); FileOutputStream fs = new FileOutputStream(newPath); byte[] buffer = new byte[10000]; while ((byteread = inStream.read(buffer)) != -1) { ... |