Class LazyIncrementalFileMergerInput

java.lang.Object
com.android.builder.merge.LazyIncrementalFileMergerInput
All Implemented Interfaces:
IncrementalFileMergerInput, OpenableCloseable, Closeable, AutoCloseable

public class LazyIncrementalFileMergerInput extends Object implements IncrementalFileMergerInput
Implementation of an IncrementalFileMergerInput that lazily loads required data.

In general, this is constructed not directly using the constructor (which absolutely can be used), but using the factory methods in LazyIncrementalFileMergerInputs.

  • Constructor Details

    • LazyIncrementalFileMergerInput

      public LazyIncrementalFileMergerInput(@NonNull String name, @NonNull com.android.tools.build.apkzlib.utils.CachedSupplier<Map<RelativeFile,com.android.ide.common.resources.FileStatus>> updates, @NonNull com.android.tools.build.apkzlib.utils.CachedSupplier<Set<RelativeFile>> files)
      Creates a new input.
      Parameters:
      name - the input name
      updates - the file and how they were updated
      files - all files
  • Method Details

    • getUpdatedPaths

      @NonNull public com.google.common.collect.ImmutableSet<String> getUpdatedPaths()
      Description copied from interface: IncrementalFileMergerInput
      Obtains all OS-independent paths of all files that were changed in this input.
      Specified by:
      getUpdatedPaths in interface IncrementalFileMergerInput
      Returns:
      the paths, may be empty if no paths were changed
    • getAllPaths

      @NonNull public com.google.common.collect.ImmutableSet<String> getAllPaths()
      Description copied from interface: IncrementalFileMergerInput
      Obtains all OS-independent paths of all files that in this input, regardless of being changed or not.
      Specified by:
      getAllPaths in interface IncrementalFileMergerInput
      Returns:
      the paths, may be empty if the relative tree of this input is empty
    • getName

      @NonNull public String getName()
      Description copied from interface: IncrementalFileMergerInput
      Obtains the name of this input.
      Specified by:
      getName in interface IncrementalFileMergerInput
      Returns:
      the name
    • getFileStatus

      @Nullable public com.android.ide.common.resources.FileStatus getFileStatus(@NonNull String path)
      Description copied from interface: IncrementalFileMergerInput
      Obtains the status of a path in this input.
      Specified by:
      getFileStatus in interface IncrementalFileMergerInput
      Parameters:
      path - the OS-independent path; the path may or not exist in the input
      Returns:
      the status of the path or null if the path does not exist in the input or if the path has not been changed; null is returned if and only if !getUpdatedPaths().contains(path)
    • openPath

      @NonNull public InputStream openPath(@NonNull String path)
      Description copied from interface: IncrementalFileMergerInput
      Opens a path for reading. This method should only be called when the input is open.
      Specified by:
      openPath in interface IncrementalFileMergerInput
      Parameters:
      path - the path
      Returns:
      the input stream that should be closed by the caller before Closeable.close() is called
    • open

      public void open()
      Description copied from interface: OpenableCloseable
      Opens the object.
      Specified by:
      open in interface OpenableCloseable
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable