Here you can find the source of copyFile(String inFile, String outFile)
Parameter | Description |
---|---|
inFile | a parameter |
outFile | a parameter |
public static boolean copyFile(String inFile, String outFile)
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { /**//from w w w . j a v a 2 s . co m * Copia um arquivo. * @param inFile * @param outFile * @return */ public static boolean copyFile(String inFile, String outFile) { InputStream is = null; OutputStream os = null; byte[] buffer; boolean success = true; try { is = new FileInputStream(inFile); os = new FileOutputStream(outFile); buffer = new byte[is.available()]; is.read(buffer); os.write(buffer); } catch (IOException e) { success = false; } catch (OutOfMemoryError e) { success = false; } finally { try { if (is != null) { is.close(); } } catch (IOException e) { } try { if (os != null) { os.close(); } } catch (IOException e) { } } is = null; os = null; return success; } }