import java.io.*;/**** @author FRANK ALBERT alias CAsoft* @version*/public class FileCopy { /** Creates new FileCopy */ public FileCopy() { } public String go(String quelle, String ziel) { return go(new File(quelle), new File(ziel)); } public String go(File quelle, File ziel) { File back = new File(ziel, ".bak"); if (ziel.exists()) { ziel.renameTo(back); } try { FileOutputStream ZFile = new FileOutputStream(ziel); FileInputStream QFile = new FileInputStream(quelle); byte[] buf = new byte[4096]; int len; while ((len = QFile.read(buf)) > 0) { ZFile.write(buf, 0, len); } QFile.close(); ZFile.close(); } catch(IOException ex) { ziel.deleteOnExit(); back.renameTo(ziel); return ex.toString(); } ziel.setLastModified(quelle.lastModified()); back.deleteOnExit(); return null; }}