CopyFile
Aus Programmers Guide
Version vom 09:34, 30. Mär. 2010 bei Roy (Diskussion | Beiträge)
public static boolean copyFile(String fileIn,String fileOut) { try { File f1 = new File(fileIn); File f2 = new File(fileOut); InputStream in = new FileInputStream(f1); 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 true; } catch (FileNotFoundException ex) { return false; } catch (IOException e) { return false; } }