List of utility methods to do File Copy
void | copyImgFile(String sourcePath, String fileId) copy Img File String newPath = getImageDir() + fileId; try { int bytesum = 0; int byteread = 0; File oldfile = new File(sourcePath); if (oldfile.exists()) { InputStream inStream = new FileInputStream(sourcePath); FileOutputStream fs = new FileOutputStream(newPath); ... |
boolean | copyResource(Class> cls, String strResSource, String strFile) Copy resource to file InputStream isSrc = null; FileOutputStream osDest = null; try { isSrc = cls.getResourceAsStream(strResSource); if (isSrc == null) throw new IOException("Resource " + strResSource + " not found"); osDest = new FileOutputStream(strFile); ... |
void | copyStringToFile(String content, String FilePath) Copy String to a File. FileWriter fstream = new FileWriter(FilePath); BufferedWriter out = new BufferedWriter(fstream); out.write(content); out.close(); |
void | copyfile(File source, File destination) copyfile FileUtils.copyFile(source, destination); |
void | dumbfilecopy(File source, File dest) Copies a file. FileOutputStream out = new FileOutputStream(dest); FileInputStream in = new FileInputStream(source); byte[] buf = new byte[(int) source.length()]; in.read(buf); out.write(buf); in.close(); out.close(); |
void | fileCopy(File dbFile, File backup) file Copy FileChannel inChannel = new FileInputStream(dbFile).getChannel(); FileChannel outChannel = new FileOutputStream(backup).getChannel(); try { inChannel.transferTo(0, inChannel.size(), outChannel); } catch (IOException e) { e.printStackTrace(); } finally { if (inChannel != null) { ... |
void | fileCopy(File sourcefile, File destinctionFile) file Copy FileInputStream stFileInputStream = null; FileOutputStream stFileOutputStream = null; try { stFileInputStream = new FileInputStream(sourcefile); stFileOutputStream = new FileOutputStream(destinctionFile); int arraySize = 1024; byte buffer[] = new byte[arraySize]; int bytesRead; ... |
void | fileCopy(File sourcefile, String destinctionFile) file Copy FileInputStream stFileInputStream = null; FileOutputStream stFileOutputStream = null; try { makeFile(destinctionFile); stFileInputStream = new FileInputStream(sourcefile); stFileOutputStream = new FileOutputStream(destinctionFile); int arraySize = 1024; byte buffer[] = new byte[arraySize]; ... |
void | fileCopy(String sourcefile, String destinctionFile) file Copy fileCopy(new File(sourcefile), destinctionFile);
|
void | bakFile(String source, String dest) bak File File file = new File(source); boolean state = file.renameTo(new File(dest)); if (!state) { fileCopy(source, dest); deleteFileOnly(source); |