/** * 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 {@link FileStatus#NEW}. This method is used to construct an * initial set of files and is, therefore, an incremental update from zero. * * @param zip the zip file to read, must be a valid, existing zip file * @return the file set * @throws IOException failed to read the zip file */ @NonNull public static ImmutableMap<RelativeFile, FileStatus> fromZip(@NonNull File zip) throws IOException { return fromZip(zip, FileStatus.NEW); }
updatedJavaResourcesBuilder.putAll( javaResourceFile.isFile() ? IncrementalRelativeFileSets.fromZip(javaResourceFile) : IncrementalRelativeFileSets.fromDirectory(javaResourceFile)); } catch (Zip64NotSupportedException e) { updatedJavaResourcesBuilder.putAll( IncrementalRelativeFileSets.fromZip( copyJavaResourcesOnly(getIncrementalFolder(), javaResourceFile)));
/** * Reads files and builds an incremental relative file set. Each individual file in * {@code files} may be a file or directory. If it is a directory, then all files in the * directory are added as if {@link #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 * {@link #fromZip(File)} had been invoked. * * <p>The status of each file is set to {@link FileStatus#NEW}. This method is used to construct * an initial set of files and is, therefore, an incremental update from zero. * * @param files the files and directories * @return the file set * @throws IOException failed to read the files */ @NonNull public static ImmutableMap<RelativeFile, FileStatus> fromZipsAndDirectories( @NonNull Iterable<File> files) throws IOException { Set<ImmutableMap<RelativeFile, FileStatus>> sets = Sets.newHashSet(); for (File f : files) { if (f.isFile()) { sets.add(fromZip(f)); } else { sets.add(fromDirectory(f)); } } return union(sets); }
IncrementalRelativeFileSets.fromZip(file); pkg.updateAndroidResources(androidResources);
relativeUpdates.putAll(fromZip(file, cache, cacheUpdates)); } else {
true)) { ImmutableMap<RelativeFile, FileStatus> androidResources = IncrementalRelativeFileSets.fromZip(androidResPkg); packager.updateAndroidResources(androidResources); for (File dexFile : dexFiles) {
return fromZip(zip, FileStatus.NEW);