Here you can find the source of copyFile(String srcFile, String destFile)
Parameter | Description |
---|---|
srcFile | a parameter |
destFile | a parameter |
public static Boolean copyFile(String srcFile, String destFile)
//package com.java2s; /*/*from w ww.j a va 2 s.c o m*/ * Copyright (C) 2010-2012 Stichting Akvo (Akvo Foundation) * * This file is part of Akvo FLOW. * * Akvo FLOW is free software: you can redistribute it and modify it under the terms of * the GNU Affero General Public License (AGPL) as published by the Free Software Foundation, * either version 3 of the License or any later version. * * Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Affero General Public License included below for more details. * * The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>. */ import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class Main { /** * copies a file to a new location on the local file system. This implementation will not create * any directories (so the destination directory must exist). * * @param srcFile * @param destFile * @return */ public static Boolean copyFile(String srcFile, String destFile) { Boolean copyFlag = false; File inputFile = new File(srcFile); File outputFile = new File(destFile); try { FileReader in = new FileReader(inputFile); FileWriter out = new FileWriter(outputFile); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); } catch (IOException ex) { ex.printStackTrace(); } return copyFlag; } }