Package io.milton.zsync
Class FileMaker
java.lang.Object
io.milton.zsync.FileMaker
This class is normally used to create a copy of a remote file, where a local
copy is already present which might contain some or all of the remote data.
FileMaker implements an algorithm similar to rsync which optimises the amount
of data downloaded by matching blocks of data in the local file against the
remote and only downloading blocks which differ.
The given local file is not updated by this class, instead a copy is produced
as a temp file, and it is up to the calling code to replace the old local
file with the new one.
Most of the code in this package was taken from the jazsync project, please
see the header comments for license details.
- Author:
- Tomáš Hlavnička, modified by Brad McEvoy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindMissingRanges(File inputFile, File metafile) Determine what ranges need to be provided to sync the file.make(File inputFile, File metafile, RangeLoader rangeLoader)
-
Constructor Details
-
FileMaker
public FileMaker()
-
-
Method Details
-
make
- Parameters:
inputFile- - the "local" file, containing data which needs to be merged with that on the servermetafile- - meta file, containing headers and checksums of the "remote", generated by MetaFileMakerrangeLoader- - accessor object, to get the binary data of the "remote" file- Throws:
Exception
-
findMissingRanges
Determine what ranges need to be provided to sync the file.- Parameters:
mfr-inputFile-rangeLoader-dryRun-- Returns:
- - null indicates everything is needed, ie whole file
- Throws:
Exception
-