java.lang.Object
de.zocher_regel.util.copy.AbstractCopier
- Alle implementierten Schnittstellen:
Runnable
- Bekannte direkte Unterklassen:
DeepCopier,ShallowCopier
Copy a directory to another location (e. g. from camera to computer or from
computer to USB-stick).
The filters are tied by "and".
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected intCounts output records.(Package privat) final FileCompareFilterIf the target file exists, check if it should be overwritten.(Package privat) final FileFilterFilters the files to be copied.(Package privat) final FilenameFilterFilters the files to be copied using their name..protected final PathThe directory from which the files are copied.protected final PathThe directory into which the files are copied. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungAbstractCopier(Path sourceDirPath, Path targetDirPath, FilenameFilter filenameFilter, FileFilter fileFilter, FileCompareFilter fileCompareFilter) Constructor -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected voidappendQualFileName(File sourceFile) Append the qualified name of the file to be copied (sourceFile) to the list (text file).voidCopy a file to the target directory.protected abstract PathgetTargetFilePath(File sourceFile) The name of the target file depends on that of the souce file.voidrun()setFromTxt(boolean fromTxt) Set the option whether the copying is made from a list (text file).setToTxt(boolean toTxt) Set the option whether the list of files to be copied is to be written to text file.protected booleanWarn if source directory and target directory overlap.
-
Felddetails
-
count
protected int countCounts output records. -
fileCompareFilter
If the target file exists, check if it should be overwritten. -
fileFilter
Filters the files to be copied. -
filenameFilter
Filters the files to be copied using their name.. -
sourceDirPath
The directory from which the files are copied. -
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 copiedtargetDirPath- to which the files will be copiedfilenameFilter- filters the files to be copiedfileFilter- filters the files to be copiedfileCompareFilter- decides whether the file is copied if the target file exists- Löst aus:
UtilException- if sourceDirPath or targetDirPath do not exist
-
-
Methodendetails
-
appendQualFileName
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
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
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() -
setFromTxt
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
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
-