Java Utililty Methods FileReader Copy

List of utility methods to do FileReader Copy

Description

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

Method

voidcopyFile(File inputFile, File outputFile)
copy File
outputFile.getParentFile().mkdirs();
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
    out.write(c);
in.close();
out.close();
...
voidcopyFile(File source, File destination)
Copy a file in the File system.
FileReader inFile = new FileReader(source);
FileWriter outFile = new FileWriter(destination);
int content;
while ((content = inFile.read()) != -1) {
    outFile.write(content);
inFile.close();
outFile.close();
...
StringcopyFile(String fromFilePath, String toFileDir)
Copies a file, located at fromFilePath into toFileDir.
FileReader inputStream = null;
FileWriter outputStream = null;
String copiedFileName = (new File(fromFilePath)).getName();
String toFilePath = toFileDir + "/" + copiedFileName;
try {
    inputStream = new FileReader(fromFilePath);
    outputStream = new FileWriter(toFilePath);
    int c;
...
booleancopyFile(String input, String output)
copy File
File inputFile = new File(input);
File outputFile = new File(output);
try {
    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;
    while ((c = in.read()) != -1)
        out.write(c);
...
voidcopyFile(String inputName, String destination)
Copyies a file to a specified desitination
File input = new File(inputName);
File outputFile = new File(destination);
FileReader in = new FileReader(input);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) {
    out.write(c);
in.close();
out.close();
voidcopyFile(String sourceFileName, String targetFileName)
Copies a file to the given target.
final File inputFile = new File(sourceFileName);
final File outputFile = new File(targetFileName);
try {
    final FileReader in = new FileReader(inputFile);
    final FileWriter out = new FileWriter(outputFile);
    int c;
    while ((c = in.read()) != -1) {
        out.write(c);
...
voidcopyFile(String srcFileName, String dstFileName)
Copy a file.
copyFile(new File(srcFileName), new File(dstFileName));
booleancopyFileToDir(File inputFile, File outputDir)
copy File To Dir
try {
    String outputFileName = inputFile.getName();
    int index = 1;
    while (existFileInDir(outputFileName, outputDir)) {
        outputFileName = index + inputFile.getName();
        index++;
    String directory = getDirectoryWithSlash(outputDir.getAbsolutePath());
...