List of utility methods to do FileInputStream Copy
boolean | copyFile(File original, File copy) Copies a file. try { FileInputStream fis = new FileInputStream(original); FileOutputStream fos = new FileOutputStream(copy); int len = fis.available(); byte[] data = new byte[len]; fis.read(data); fos.write(data); fis.close(); ... |
void | copyFile(File original, File destination) Copy the file original to the file destination .
if (!original.exists()) { throw new FileNotFoundException("File not found: " + original.getName()); if (original.isHidden()) { return; if (original.equals(destination)) { throw new IOException("Cannot copy " + original.getName() + " into itself."); ... |
boolean | copyFile(File original, File parent) copy File try { FileInputStream input = new FileInputStream(original); File outputFile = new File(parent, original.getName()); FileOutputStream output = new FileOutputStream(outputFile); int data; while ((data = input.read()) != -1) { output.write(data); input.close(); output.close(); return true; } catch (FileNotFoundException fnfe) { return false; } catch (IOException ioe) { return false; |
File | copyFile(File originalFile, File destinationDir) copy File File[] fileList = destinationDir.listFiles(); String nextFilename; if (fileList.length > 0) { String lastFilename = destinationDir.listFiles()[fileList.length - 1].getName(); int idxDotLastFile = lastFilename.indexOf("."); String originalFileName = originalFile.getName(); int idxDotOriginalFile = originalFileName.indexOf("."); String fileSuffix = originalFileName.substring(idxDotOriginalFile + 1); ... |
void | copyFile(File pSrc, File pDst, boolean pForce) Copy the file src into the file dst. if (pSrc == null || !pSrc.canRead()) { throw new IOException("FileHelper.ReadError" + (pSrc == null ? "" : pSrc.getAbsolutePath())); if (pDst == null) { throw new IOException("FileHelper.NullDestinationError"); if (pForce && pDst.exists() && pDst.isFile()) { pDst.delete(); ... |
boolean | copyFile(File source, File dest) copy File boolean result = true; FileInputStream in = null; FileOutputStream out = null; final byte[] buffer = new byte[32768]; try { in = new FileInputStream(source); out = new FileOutputStream(dest); while (true) { ... |
void | copyFile(File source, File dest) Copies the source file to the dest file InputStream in = null; OutputStream out = null; try { if (!dest.exists()) { dest.createNewFile(); in = new FileInputStream(source); out = new FileOutputStream(dest); ... |
void | copyFile(File source, File dest) copy File if (!dest.exists()) { dest.createNewFile(); InputStream in = null; OutputStream out = null; try { in = new FileInputStream(source); out = new FileOutputStream(dest); ... |
void | copyFile(File source, File dest) Copy a file (a "real" file, not directory). if (!source.exists()) { return; if (!source.canRead()) { throw new IOException("No read permission for file \"" + source + "\""); if (source.isDirectory()) { throw new IOException("Source file \"" + source + " is a directory"); ... |
void | copyFile(File source, File dest) copy File copyStream(new FileInputStream(source), new FileOutputStream(dest)); |