List of utility methods to do File Copy
void | doCopyFile(File srcFile, File destFile, boolean preserveFileDate) do Copy File if (destFile.exists() && destFile.isDirectory()) { throw new IOException("Destination '" + destFile + "' exists but is a directory"); FileInputStream input = new FileInputStream(srcFile); try { FileOutputStream output = new FileOutputStream(destFile); try { copy(input, output); ... |
void | fileCopy(File source, String dest) file Copy final File newFile = new File(dest); final byte[] buffer = new byte[4096]; final FileInputStream inputStream = new FileInputStream(source); final FileOutputStream outputStream = new FileOutputStream(newFile); int len; while ((len = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, len); inputStream.close(); outputStream.close(); |
void | fileCopy(File srcFile, File tarFile) file Copy FileInputStream is = null; FileOutputStream os = null; try { is = new FileInputStream(srcFile); os = new FileOutputStream(tarFile); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = is.read(buffer, 0, 8192)) != -1) { ... |
void | FileCopy(InputStream input, OutputStream output, int bufferSize) File Copy byte[] buf = new byte[bufferSize]; int n = input.read(buf); while (n >= 0) { output.write(buf, 0, n); n = input.read(buf); output.flush(); |
void | fileCopy(String from, String to) Copy a file. fileThing(from, to, false); |
void | fileCopy(String from, String to) file copy FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(from); fos = new FileOutputStream(to); final int BUFSIZ = 1024; byte buf[] = new byte[BUFSIZ]; int len = 0; ... |
void | fileCopy(String fromPath, String toPath) file Copy File inputFile = new File(fromPath); File outputFile = new File(toPath); FileReader in = new FileReader(inputFile); FileWriter out = new FileWriter(outputFile); int c; while ((c = in.read()) != -1) out.write(c); in.close(); ... |
boolean | fileCopy(String oldFilePath, String newFilePath, boolean isCover) file Copy if (!checkFile(oldFilePath, false)) { return false; if (checkFile(newFilePath, true) && (!isCover)) { return false; FileInputStream in = null; FileOutputStream out = null; ... |
void | fileCopy(String sFrom, String sTo) file Copy File f1 = new File(sFrom); File f2 = new File(sTo); InputStream in = new FileInputStream(f1); OutputStream out = new FileOutputStream(f2); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); ... |
void | fileCopy(String source, String target) file Copy try (InputStream in = new FileInputStream(source)) { try (OutputStream out = new FileOutputStream(target)) { byte[] buffer = new byte[4096]; int bytesToRead; while ((bytesToRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesToRead); |