Class RelativeFiles

java.lang.Object
com.android.builder.files.RelativeFiles

public final class RelativeFiles extends Object
Utilities to handle RelativeFile.
  • Method Details

    • fromDirectory

      @NonNull public static Set<RelativeFile> fromDirectory(@NonNull File directory)
      Loads all files in a directory recursively.
      Parameters:
      directory - the directory, must exist and be a readable directory
      Returns:
      all files in the directory, sub-directories included
    • fromDirectory

      @NonNull public static Set<RelativeFile> fromDirectory(@NonNull File directory, @NonNull Predicate<RelativeFile> filter)
      Loads all files in a directory recursively, filtering the results with a predicate. Filtering is only done at the end so, even if a directory is excluded from the filter, its files will be included if they are accepted by the filter.
      Parameters:
      directory - the directory, must exist and be a readable directory
      filter - a predicate to filter which files should be included in the result; only files to whom the filter application results in true are included in the result
      Returns:
      all files in the directory, sub-directories included
    • fromPathPredicate

      @NonNull public static Predicate<RelativeFile> fromPathPredicate(@NonNull Predicate<String> predicate)
      Constructs a predicate over relative files from a predicate over paths, applying it to the normalized relative path contained in the relative file.
      Parameters:
      predicate - the file predicate
      Returns:
      the relative file predicate built upon predicate
    • fromZip

      @NonNull public static Set<RelativeFile> fromZip(@NonNull com.android.builder.files.ZipCentralDirectory zip) throws IOException
      Reads a zip file and adds all files in the file in a new relative set.
      Parameters:
      zip - the zip file to read, must be a valid, existing zip file
      Returns:
      the file set
      Throws:
      IOException - failed to read the zip file