Interface IncrementalFileMergerInput

All Superinterfaces:
AutoCloseable, Closeable, OpenableCloseable
All Known Implementing Classes:
DelegateIncrementalFileMergerInput, FilterIncrementalFileMergerInput, LazyIncrementalFileMergerInput, RenameIncrementalFileMergerInput

public interface IncrementalFileMergerInput extends OpenableCloseable
Input for an incremental merge operation (see IncrementalFileMerger.merge(java.util.List, IncrementalFileMergerOutput, IncrementalFileMergerState, Predicate).

An input represents a relative tree and a set of changed paths. Note that deleted paths are reported in the changes, although they are no longer part of the relative tree because, well, they were deleted :)

The input contains both the updated relative files (see getUpdatedPaths()) and the current set of relative files (see getAllPaths().

Each IncrementalFileMergerInput is identified by a name and a contains a set of updates on RelativeFile. These are usually obtained using the methods from IncrementalRelativeFileSets.

The input is responsible for reading input files given their paths to the input. This makes the actual source of the data invisible to the user.

Because not all methods are necessarily needed for every merge operation, it is recommended to use LazyIncrementalFileMergerInput as implementation.

  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.common.collect.ImmutableSet<String>
    Obtains all OS-independent paths of all files that in this input, regardless of being changed or not.
    com.android.ide.common.resources.FileStatus
    Obtains the status of a path in this input.
    Obtains the name of this input.
    com.google.common.collect.ImmutableSet<String>
    Obtains all OS-independent paths of all files that were changed in this input.
    Opens a path for reading.

    Methods inherited from interface java.io.Closeable

    close

    Methods inherited from interface com.android.builder.merge.OpenableCloseable

    open
  • Method Details

    • getUpdatedPaths

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

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

      @NonNull String getName()
      Obtains the name of this input.
      Returns:
      the name
    • getFileStatus

      @Nullable com.android.ide.common.resources.FileStatus getFileStatus(@NonNull String path)
      Obtains the status of a path in this input.
      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 InputStream openPath(@NonNull String path)
      Opens a path for reading. This method should only be called when the input is open.
      Parameters:
      path - the path
      Returns:
      the input stream that should be closed by the caller before Closeable.close() is called