Here you can find the source of copyFilesToLocal(String destination, String source)
protected static String copyFilesToLocal(String destination, String source)
//package com.java2s; /*L/*from w w w. ja v a 2 s . c o m*/ * Copyright The General Hospital Corporation d/b/a Massachusetts General Hospital * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/digital-model-repository/LICENSE.txt for details. */ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { protected static String copyFilesToLocal(String destination, String source) { try { File f1 = new File(source); File f2 = new File(destination, f1.getName()); InputStream in = new FileInputStream(f1); // For Overwrite the file. OutputStream out = new FileOutputStream(f2); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); return f2.getName(); } catch (IOException e) { e.printStackTrace(); } return null; } }