Here you can find the source of copyFile(File source, File dest)
Parameter | Description |
---|---|
source | a parameter |
dest | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
public static void copyFile(File source, File dest) throws IOException
//package com.java2s; //License from project: LGPL import java.io.*; public class Main { /**/*w ww . jav a2 s. co m*/ * change the dest's opengraph id from OG to file path * @param source * @param dest * @throws IOException */ public static void copyFile(File source, File dest) throws IOException { BufferedReader br = new BufferedReader(new FileReader(source)); BufferedWriter bw = new BufferedWriter(new FileWriter(dest)); String result = ""; try { while ((result = br.readLine()) != null) { String a = dest.getName().replaceAll("\\.", "_"); result = result.replaceAll("OG_", a); bw.write(result + "\r\n"); bw.flush(); } } finally { br.close(); bw.close(); } } }