Class IncrementalRelativeFileSets

java.lang.Object
com.android.builder.files.IncrementalRelativeFileSets

public final class IncrementalRelativeFileSets extends Object
Utilities for incremental relative file sets, immutable maps of relative files to status.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus>
    fromDirectory(File directory)
    Deprecated.
    Prefer the new Gradle InputChanges API.
    static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus>
    fromZip(com.android.builder.files.ZipCentralDirectory zip)
    Reads a zip file and adds all files in the file in a new incremental relative set.
    static Map<RelativeFile,com.android.ide.common.resources.FileStatus>
    fromZip(com.android.builder.files.ZipCentralDirectory zipCentralDirectory, KeyedFileCache cache, Set<Runnable> cacheUpdates)
    Computes the incremental file set that results from comparing a zip file with a possibly existing cached file.
    static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus>
    fromZip(com.android.builder.files.ZipCentralDirectory zip, com.android.ide.common.resources.FileStatus status)
    Reads a zip file and adds all files in the file in a new incremental relative set.
    static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus>
    Reads a zip file and adds all files in the file in a new incremental relative set.
    static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus>
    fromZip(File zip, com.android.ide.common.resources.FileStatus status)
    Reads a zip file and adds all files in the file in a new incremental relative set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • fromDirectory

      @Deprecated @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromDirectory(@NonNull File directory)
      Deprecated.
      Prefer the new Gradle InputChanges API.
      Reads a directory and adds all files in the directory in a new incremental relative set. The status of each file is set to FileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.
      Parameters:
      directory - the directory, must be an existing directory
      Returns:
      the file set
    • fromZip

      @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull File zip) throws IOException
      Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set to FileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.
      Parameters:
      zip - the zip file to read, must be a valid, existing zip file
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file
    • fromZip

      @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull File zip, com.android.ide.common.resources.FileStatus status) throws IOException
      Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set to status.
      Parameters:
      zip - the zip file to read, must be a valid, existing zip file
      status - the status to set the files to
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file
    • fromZip

      @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zip) throws IOException
      Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set to FileStatus.NEW. This method is used to construct an initial set of files and is, therefore, an incremental update from zero.
      Parameters:
      zip - the zip file to read, must be a valid, existing zip file
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file
    • fromZip

      @NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zip, com.android.ide.common.resources.FileStatus status) throws IOException
      Reads a zip file and adds all files in the file in a new incremental relative set. The status of each file is set to status.
      Parameters:
      zip - the zip file to read, must be a valid, existing zip file
      status - the status to set the files to
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file
    • fromZip

      @NonNull public static Map<RelativeFile,com.android.ide.common.resources.FileStatus> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zipCentralDirectory, @NonNull KeyedFileCache cache, @NonNull Set<Runnable> cacheUpdates) throws IOException
      Computes the incremental file set that results from comparing a zip file with a possibly existing cached file. If the cached file does not exist, then the whole zip is reported as FileStatus.NEW. If zip does not exist and a cached file exists, then the whole zip is reported as FileStatus.REMOVED. Otherwise, both zips are compared and the difference returned.
      Parameters:
      zipCentralDirectory - the zip file to read, must be a valid, existing zip file
      cache - the cache where to find the old version of the zip
      cacheUpdates - receives all runnables that will update the cache; running all runnables placed in this set will ensure that a second invocation of this method reports no changes
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file