public final class IncrementalRelativeFileSets
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
IncrementalRelativeFileSets.FileDeletionPolicy
Policy for file deletions.
|
| Modifier and Type | Method and Description |
|---|---|
static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> |
fromDirectory(java.io.File directory)
Reads a directory and adds all files in the directory in a new incremental relative set.
|
static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> |
fromZip(java.io.File zip)
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.res2.FileStatus> |
fromZip(java.io.File zip,
FileCacheByPath cache,
java.util.Set<java.lang.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.res2.FileStatus> |
fromZip(java.io.File zip,
com.android.ide.common.res2.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.res2.FileStatus> |
fromZipsAndDirectories(java.lang.Iterable<java.io.File> files)
Reads files and builds an incremental relative file set.
|
static int |
getBaseDirectoryCount(com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> set)
Counts how many different base directories are there in a relative file set.
|
static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> |
makeFromBaseFiles(java.util.Collection<java.io.File> baseFiles,
java.util.Map<java.io.File,com.android.ide.common.res2.FileStatus> updates,
FileCacheByPath cache,
java.util.Set<java.lang.Runnable> cacheUpdates,
IncrementalRelativeFileSets.FileDeletionPolicy fileDeletionPolicy)
Builds an incremental relative file set from a set of modified files.
|
static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> |
union(java.lang.Iterable<com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus>> sets)
Computes the incremental relative file set that is the union of all provided sets.
|
@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> fromDirectory(@NonNull java.io.File directory)
FileStatus.NEW. This method is used to construct
an initial set of files and is, therefore, an incremental update from zero.directory - the directory, must be an existing directory@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> fromZip(@NonNull java.io.File zip) throws java.io.IOException
FileStatus.NEW. This method is used to construct an
initial set of files and is, therefore, an incremental update from zero.zip - the zip file to read, must be a valid, existing zip filejava.io.IOException - failed to read the zip file@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> fromZip(@NonNull java.io.File zip, com.android.ide.common.res2.FileStatus status) throws java.io.IOException
status.zip - the zip file to read, must be a valid, existing zip filestatus - the status to set the files tojava.io.IOException - failed to read the zip file@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> fromZip(@NonNull java.io.File zip, @NonNull FileCacheByPath cache, @NonNull java.util.Set<java.lang.Runnable> cacheUpdates) throws java.io.IOException
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.zip - the zip file to read, must be a valid, existing zip filecache - the cache where to find the old version of the zipcacheUpdates - 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 changesjava.io.IOException - failed to read the zip file@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> union(@NonNull java.lang.Iterable<com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus>> sets)
sets - the sets to unionpublic static int getBaseDirectoryCount(@NonNull
com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> set)
RelativeFile and count how many distinct bases are that
that are directories.set - the file set@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> fromZipsAndDirectories(@NonNull java.lang.Iterable<java.io.File> files) throws java.io.IOException
files may be a file or directory. If it is a directory, then all files in the
directory are added as if fromDirectory(File) had been invoked; if it is a file,
then it is assumed to be a zip file and all files in the zip are added as if
fromZip(File) had been invoked.
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.
files - the files and directoriesjava.io.IOException - failed to read the files@NonNull public static com.google.common.collect.ImmutableMap<RelativeFile,com.android.ide.common.res2.FileStatus> makeFromBaseFiles(@NonNull java.util.Collection<java.io.File> baseFiles, @NonNull java.util.Map<java.io.File,com.android.ide.common.res2.FileStatus> updates, @NonNull FileCacheByPath cache, @NonNull java.util.Set<java.lang.Runnable> cacheUpdates, @NonNull IncrementalRelativeFileSets.FileDeletionPolicy fileDeletionPolicy) throws java.io.IOException
If there are new zip files, then all files in the zip are added to the result data set. If there are deleted or updated zips, then the relative incremental changes are added to the data set. To allow detecting incremental changes in zips, the provided cache is used.
baseFiles - the files; all entries must exist and be either directories or zip filesupdates - the files updated in the directories or base zip files updatedcache - the file cache where to find old versions of zip filescacheUpdates - 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
for zip files; the updates are reported as deferrable runnables instead of immediately
run in this method to allow not changing the cache contents if something else fails and
we want to restore the previous statefileDeletionPolicy - the policy for file deletionsjava.io.IOException - failed to read a zip file