Class FileMaker

java.lang.Object
io.milton.zsync.FileMaker

public class FileMaker extends Object
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 Details

    • FileMaker

      public FileMaker()
  • Method Details

    • make

      public File make(File inputFile, File metafile, RangeLoader rangeLoader) throws Exception
      Parameters:
      inputFile - - the "local" file, containing data which needs to be merged with that on the server
      metafile - - meta file, containing headers and checksums of the "remote", generated by MetaFileMaker
      rangeLoader - - accessor object, to get the binary data of the "remote" file
      Throws:
      Exception
    • findMissingRanges

      public List<Range> findMissingRanges(File inputFile, File metafile) throws Exception
      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