Here you can find the source of writeFileData(File dataFile, String targetFile)
public static void writeFileData(File dataFile, String targetFile) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeFileData(File dataFile, String targetFile) throws IOException { FileInputStream istream = new FileInputStream(dataFile); FileOutputStream ostream = new FileOutputStream(targetFile); byte[] buffer = new byte[1024]; int len = 0; while ((len = istream.read(buffer)) != -1) { ostream.write(buffer, 0, len); }//w w w .j av a2s .c om istream.close(); ostream.close(); } }