Package com.android.builder.merge
Class RenameIncrementalFileMergerInput
java.lang.Object
com.android.builder.merge.DelegateIncrementalFileMergerInput
com.android.builder.merge.RenameIncrementalFileMergerInput
- All Implemented Interfaces:
IncrementalFileMergerInput,OpenableCloseable,Closeable,AutoCloseable
IncrementalFileMergerInput that renames files in another input according to a renaming
function. This means that the actual paths of the files reported have been transformed.
For example, a rename input that prepends a/ to the files created over an input
that has file b, will report having file a/b. Opening file a/b will
effectively open file b.
The rename input will effectively create a view over another input in which files have been
renamed according to an injective function. Because name transformation needs to occur in both
directions, for example, it is necessary to transform b into a/b and a/b
back into b, the rename input needs to receive two functions: the transformation function
and its inverse.
Both rename and inverse rename functions are assumed to be stable, that is, the transformations should always yield the same output for the same input.
-
Constructor Summary
ConstructorsConstructorDescriptionRenameIncrementalFileMergerInput(IncrementalFileMergerInput input, Function<String, String> rename, Function<String, String> inverseRename) Creates a new input. -
Method Summary
Modifier and TypeMethodDescriptioncom.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.FileStatusgetFileStatus(String path) Obtains the status of a path in 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 class com.android.builder.merge.DelegateIncrementalFileMergerInput
close, getName, open
-
Constructor Details
-
RenameIncrementalFileMergerInput
public RenameIncrementalFileMergerInput(@NonNull IncrementalFileMergerInput input, @NonNull Function<String, String> rename, @NonNull Function<String, String> inverseRename) Creates a new input.- Parameters:
input- the input that serves as input for this onerename- the function that renames paths as they are reported byinputto whatever this input should return as paths; the function should be bijectiveinverseRename- the function that provides the inverse ofrename
-
-
Method Details
-
getUpdatedPaths
Description copied from interface:IncrementalFileMergerInputObtains all OS-independent paths of all files that were changed in this input.- Specified by:
getUpdatedPathsin interfaceIncrementalFileMergerInput- Overrides:
getUpdatedPathsin classDelegateIncrementalFileMergerInput- Returns:
- the paths, may be empty if no paths were changed
-
getAllPaths
Description copied from interface:IncrementalFileMergerInputObtains all OS-independent paths of all files that in this input, regardless of being changed or not.- Specified by:
getAllPathsin interfaceIncrementalFileMergerInput- Overrides:
getAllPathsin classDelegateIncrementalFileMergerInput- Returns:
- the paths, may be empty if the relative tree of this input is empty
-
getFileStatus
Description copied from interface:IncrementalFileMergerInputObtains the status of a path in this input.- Specified by:
getFileStatusin interfaceIncrementalFileMergerInput- Overrides:
getFileStatusin classDelegateIncrementalFileMergerInput- Parameters:
path- the OS-independent path; the path may or not exist in the input- Returns:
- the status of the path or
nullif the path does not exist in the input or if the path has not been changed;nullis returned if and only if!getUpdatedPaths().contains(path)
-
openPath
Description copied from interface:IncrementalFileMergerInputOpens a path for reading. This method should only be called when the input is open.- Specified by:
openPathin interfaceIncrementalFileMergerInput- Overrides:
openPathin classDelegateIncrementalFileMergerInput- Parameters:
path- the path- Returns:
- the input stream that should be closed by the caller before
Closeable.close()is called
-