public class RenameIncrementalFileMergerInput extends DelegateIncrementalFileMergerInput
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 and Description |
|---|
RenameIncrementalFileMergerInput(IncrementalFileMergerInput input,
java.util.function.Function<java.lang.String,java.lang.String> rename,
java.util.function.Function<java.lang.String,java.lang.String> inverseRename)
Creates a new input.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableSet<java.lang.String> |
getAllPaths()
Obtains all OS-independent paths of all files that in this input, regardless of being changed
or not.
|
com.android.ide.common.res2.FileStatus |
getFileStatus(java.lang.String path)
Obtains the status of a path in this input.
|
com.google.common.collect.ImmutableSet<java.lang.String> |
getUpdatedPaths()
Obtains all OS-independent paths of all files that were changed in this input.
|
java.io.InputStream |
openPath(java.lang.String path)
Opens a path for reading.
|
close, getName, openpublic RenameIncrementalFileMergerInput(@NonNull
IncrementalFileMergerInput input,
@NonNull
java.util.function.Function<java.lang.String,java.lang.String> rename,
@NonNull
java.util.function.Function<java.lang.String,java.lang.String> inverseRename)
input - the input that serves as input for this onerename - the function that renames paths as they are reported by input to
whatever this input should return as paths; the function should be bijectiveinverseRename - the function that provides the inverse of rename@NonNull public com.google.common.collect.ImmutableSet<java.lang.String> getUpdatedPaths()
IncrementalFileMergerInputgetUpdatedPaths in interface IncrementalFileMergerInputgetUpdatedPaths in class DelegateIncrementalFileMergerInput@NonNull public com.google.common.collect.ImmutableSet<java.lang.String> getAllPaths()
IncrementalFileMergerInputgetAllPaths in interface IncrementalFileMergerInputgetAllPaths in class DelegateIncrementalFileMergerInput@Nullable
public com.android.ide.common.res2.FileStatus getFileStatus(@NonNull
java.lang.String path)
IncrementalFileMergerInputgetFileStatus in interface IncrementalFileMergerInputgetFileStatus in class DelegateIncrementalFileMergerInputpath - the OS-independent path; the path may or not exist in the inputnull 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)@NonNull
public java.io.InputStream openPath(@NonNull
java.lang.String path)
IncrementalFileMergerInputopenPath in interface IncrementalFileMergerInputopenPath in class DelegateIncrementalFileMergerInputpath - the pathOpenableCloseable.close() is
called