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 src, File dst)
copy File
FileInputStream fis = null;
try {
    fis = new FileInputStream(src);
    copyToFile(fis, dst);
} finally {
    closeQuietly(fis);
voidcopyFile(File src, File dst)
copy File
FileInputStream in = new FileInputStream(src);
try {
    writeTo(in, dst);
} finally {
    in.close();
voidcopyFile(File src, File dst)
copies content of src file to dst
if (dst.exists())
    dst.delete();
dst.createNewFile();
InputStream in = new FileInputStream(src);
saveToFile(in, dst);
in.close();
voidcopyFile(File src, File dst)
copy File
byte[] buffer = new byte[COPY_BUFFER_SIZE];
InputStream in = new FileInputStream(src);
try {
    long srcLMD = 0L;
    srcLMD = src.lastModified();
    if (srcLMD == 0) {
        throw new IOException("Failed to get the last modification " + "time of " + src.getAbsolutePath());
    OutputStream out = new FileOutputStream(dst);
    try {
        int ln;
        while ((ln = in.read(buffer)) != -1) {
            out.write(buffer, 0, ln);
    } finally {
        out.close();
    if (srcLMD != 0L) {
        if (!dst.setLastModified(srcLMD)) {
            throw new IOException("Failed to set last-modification-date for: " + dst.getAbsolutePath());
} finally {
    in.close();
booleancopyFile(File src, File dst)
copy File
byte[] buf = new byte[65536];
int read;
try {
    FileInputStream fis = new FileInputStream(src);
    FileOutputStream fos = new FileOutputStream(dst);
    while ((read = fis.read(buf)) > 0)
        fos.write(buf, 0, read);
    silentClose(fos);
...
voidcopyFile(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;
...
voidcopyFile(File src, File dst)
Copies a file
FileInputStream in = null;
FileOutputStream out = null;
try {
    in = new FileInputStream(src);
    out = new FileOutputStream(dst);
    byte buf[] = new byte[1024];
    int nRead = 0;
    int offset = 0;
...
voidcopyFile(File src, File dst)
copy File
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dst);
try {
    copyStream(in, out);
} finally {
    closeQuietly(in);
    closeQuietly(out);
voidcopyFile(File src, File dst, boolean copyLMD)
Copies a file; silently overwrites the destination if already exists.
byte[] buffer = new byte[1024 * 64];
InputStream in = new FileInputStream(src);
try {
    long srcLMD = 0L;
    if (copyLMD) {
        srcLMD = src.lastModified();
        if (srcLMD == 0) {
            throw new IOException(
...
booleancopyFile(File src, File target)
copy File
FileOutputStream fs = null;
InputStream inStream = null;
try {
    int byteread = 0;
    fs = new FileOutputStream(new File(target.getAbsolutePath()));
    inStream = new FileInputStream(src);
    if (src.exists()) {
        byte[] buffer = new byte[4096];
...