Klasse AbstractCopier

java.lang.Object
de.zocher_regel.util.copy.AbstractCopier
Alle implementierten Schnittstellen:
Runnable
Bekannte direkte Unterklassen:
DeepCopier, ShallowCopier

public abstract class AbstractCopier extends Object implements Runnable
Copy a directory to another location (e. g. from camera to computer or from computer to USB-stick). The filters are tied by "and".
  • Felddetails

    • count

      protected int count
      Counts output records.
    • fileCompareFilter

      final FileCompareFilter fileCompareFilter
      If the target file exists, check if it should be overwritten.
    • fileFilter

      final FileFilter fileFilter
      Filters the files to be copied.
    • filenameFilter

      final FilenameFilter filenameFilter
      Filters the files to be copied using their name..
    • sourceDirPath

      protected final Path sourceDirPath
      The directory from which the files are copied.
    • targetDirPath

      protected final Path targetDirPath
      The directory into which the files are copied.
  • Konstruktordetails

    • AbstractCopier

      public AbstractCopier(Path sourceDirPath, Path targetDirPath, FilenameFilter filenameFilter, FileFilter fileFilter, FileCompareFilter fileCompareFilter) throws UtilException
      Constructor
      Parameter:
      sourceDirPath - from which the files will be copied
      targetDirPath - to which the files will be copied
      filenameFilter - filters the files to be copied
      fileFilter - filters the files to be copied
      fileCompareFilter - decides whether the file is copied if the target file exists
      Löst aus:
      UtilException - if sourceDirPath or targetDirPath do not exist
  • Methodendetails

    • appendQualFileName

      protected void appendQualFileName(File sourceFile) throws UtilException
      Append the qualified name of the file to be copied (sourceFile) to the list (text file).
      Parameter:
      sourceFile - the file to be copied
      Löst aus:
      UtilException - in any case of error
    • copy

      public void copy(File sourceFile) throws UtilException
      Copy a file to the target directory. The name may have be read from a TXT file or from a directory.
      Parameter:
      sourceFile - the file to be copied
      Löst aus:
      UtilException - if a file cannot be copied
    • getTargetFilePath

      protected abstract Path getTargetFilePath(File sourceFile) throws UtilException
      The name of the target file depends on that of the souce file.
      Parameter:
      sourceFile - to be copied
      Gibt zurück:
      depending on deep or shallow copy, the path of the target file
      Löst aus:
      UtilException - in case of any error
    • run

      public void run()
      Angegeben von:
      run in Schnittstelle Runnable
    • setFromTxt

      public AbstractCopier setFromTxt(boolean fromTxt)
      Set the option whether the copying is made from a list (text file).
      Parameter:
      fromTxt - if a text file contains the list of files to be copied
      Gibt zurück:
      echo of this
    • setToTxt

      public AbstractCopier setToTxt(boolean toTxt)
      Set the option whether the list of files to be copied is to be written to text file.
      Parameter:
      toTxt - if the list target files is to be written into a text file
      Gibt zurück:
      echo of this
    • sourceTargetOverlap

      protected boolean sourceTargetOverlap()
      Warn if source directory and target directory overlap.
      Gibt zurück:
      if they overlap