Java Utililty Methods FileInputStream Copy

List of utility methods to do FileInputStream Copy

Description

The list of methods to do FileInputStream Copy are organized into topic(s).

Method

voidcopyFile(File source, File dest)
Copy a normal file to another.
if (source == null)
    throw new IllegalArgumentException("source cannot be null");
if (dest == null)
    throw new IllegalArgumentException("dest cannot be null");
if (dest.isDirectory()) {
    dest = new File(dest, source.getName());
if (!dest.exists()) {
...
voidcopyFile(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);
...
voidcopyFile(File source, File dest)
copy File
if (!dest.exists()) {
    try {
        dest.createNewFile();
    } catch (IOException e) {
        e.printStackTrace();
InputStream in = null;
...
voidcopyFile(File source, File destination)
copy File
if ((destination.getParentFile() != null) && (!destination.getParentFile().exists())) {
    destination.getParentFile().mkdirs();
FileInputStream fis = null;
FileOutputStream fos = null;
try {
    fis = new FileInputStream(source);
    fos = new FileOutputStream(destination);
...
voidcopyFile(File source, File destination)
Copy a file from source to destination.
FileOutputStream fos = new FileOutputStream(destination);
FileInputStream fis = new FileInputStream(source);
copyStream(fis, fos);
fos.flush();
fos.close();
fis.close();
voidcopyFile(File source, File destination)
copy File
if (!source.exists() || !source.isFile()) {
    throw new IOException("Source is not valid for copying.");
if (!destination.exists()) {
    destination.getParentFile().mkdirs();
    destination.createNewFile();
final File realDest = destination.isDirectory() ? new File(destination, source.getName()) : destination;
...
voidcopyFile(File source, File destination)
Copies a file;
FileOutputStream out = null;
FileInputStream in = null;
try {
    destination.getParentFile().mkdirs();
    out = new FileOutputStream(destination);
    in = new FileInputStream(source);
    byte[] buff = new byte[1024];
    int read = 0;
...
voidcopyFile(File source, File destination)
Copies the source file to the destination filename.
RandomAccessFile out = new RandomAccessFile(destination, "rw");
out.setLength(source.length());
FileInputStream in = new FileInputStream(source);
byte[] buffer = new byte[16384];
while (true) {
    int n = in.read(buffer);
    if (n == -1)
        break;
...
booleancopyFile(File source, File destination)
copy source to destination, missing dirs are created, existing destination-file will be overwritten
boolean ok = false;
InputStream in = null;
try {
    mkDirs(destination.getParentFile());
    in = new FileInputStream(source);
    writeToFile(destination, in);
    in = null;
} catch (FileNotFoundException e) {
...
voidcopyFile(File source, File destination)
copy File
FileInputStream fis = new FileInputStream(source);
if (destination.isDirectory()) {
    destination = new File(destination, source.getName());
FileOutputStream fos = new FileOutputStream(destination);
try {
    copyStream(fis, fos);
} finally {
...