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(String source, String targetDirectory, String filesep)
copy File
byte[] buffer = new byte[4096];
int bytes_read;
FileInputStream fis = null;
FileOutputStream fos = null;
File fileToCopy = null;
File copiedFile = null;
try {
    fileToCopy = new File(System.getProperty("user.dir") + filesep + source);
...
StringcopyFile(String sourceFile, String destDir, String newFileName)
copy File
return copyFile(new FileInputStream(sourceFile), destDir, newFileName);
voidcopyFile(String sourceFile, String destFile)
copyFile (source,dest) copies the file from one location to another one
InputStream in = new FileInputStream(sourceFile);
OutputStream out = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];
int length;
while ((length = in.read(buffer)) > 0) {
    out.write(buffer, 0, length);
in.close();
...
voidcopyFile(String sourcefile, String targetfile)
copy File
InputStream inStream = null;
OutputStream outStream = null;
try {
    File afile = new File(sourcefile);
    File bfile = new File(targetfile);
    inStream = new FileInputStream(afile);
    outStream = new FileOutputStream(bfile);
    byte[] buffer = new byte[1024];
...
voidcopyFile(String sourcefile, String targetFile)
copy File
File sourceFile = new File(sourcefile);
if (sourceFile.exists()) {
    copyFile(sourceFile, new File(targetFile));
booleancopyFile(String sourceFile, String targetFile)
copy File
File file1 = new File(sourceFile);
File file2 = new File(targetFile);
FileInputStream fis = null;
FileOutputStream fos = null;
boolean isOK = true;
try {
    if (file1.exists()) {
        if (!file2.exists()) {
...
voidcopyFile(String sourceFile, String targetFolder)
Copies a source file to a target folder
assert (new File(sourceFile).isFile());
assert (new File(targetFolder).isDirectory());
File source = new File(sourceFile);
copyFile(source.getParent(), targetFolder, source.getName());
voidcopyFile(String sourceFile, String targetFolder)
copy File
if (!(new File(sourceFile)).isFile()) {
    throw new AssertionError();
if (!(new File(targetFolder)).isDirectory()) {
    throw new AssertionError();
} else {
    File source = new File(sourceFile);
    copyFile(source.getParent(), targetFolder, source.getName());
...
voidCopyFile(String sourceFilePath, String destinationFilePath)
Copies a file from one location to another.
File sourceFile = new File(sourceFilePath);
if (sourceFile.exists()) {
    File destinationFile = new File(destinationFilePath);
    InputStream in = new FileInputStream(sourceFile);
    OutputStream out = new FileOutputStream(destinationFile);
    byte[] buf = new byte[1024];
    int len;
    while ((len = in.read(buf)) > 0)
...
voidcopyFile(String sourceFilePath, String destinationFilePath)
copy File
InputStream in = null;
OutputStream out = null;
try {
    in = new FileInputStream(new File(sourceFilePath));
    out = new FileOutputStream(new File(destinationFilePath));
    byte[] buf = new byte[1024];
    int len;
    while ((len = in.read(buf)) > 0) {
...