Package de.willuhn.io

Class FileCopy


  • public class FileCopy
    extends java.lang.Object
    Zum Dateien kopieren.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  FileCopy.FileExistsException
      Wird geworfen, wenn eine Datei ueberschrieben werden soll, die bereits existiert.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileCopy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(java.io.File from, java.io.File to, boolean force)
      Kopiert die Quell-Datei zur Ziel-Datei.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileCopy

        public FileCopy()
    • Method Detail

      • copy

        public static void copy​(java.io.File from,
                                java.io.File to,
                                boolean force)
                         throws java.io.IOException,
                                FileCopy.FileExistsException
        Kopiert die Quell-Datei zur Ziel-Datei. Wenn es sich beim Ziel um ein Verzeichnis handelt, wird die Quell- Datei in dieses Verzeichnis kopiert. Handelt es sich bei dem Ziel um eine Datei, wird sie gegen die Quelle ersetzt bzw. neu erstellt.
        Parameters:
        from - Quelle.
        to - Ziel.
        force - Ohne Warnung ueberschreiben, falls die Zieldatei bereits existiert.
        Throws:
        java.io.IOException - Wenn beim Kopieren ein Fehler auftrat
        FileCopy.FileExistsException - wenn die Zieldatei existiert und force false ist.