Class PathFinder

java.lang.Object
xyz.ronella.trivial.handy.PathFinder

public final class PathFinder extends Object
A class that will find the first existence of a file based on the directories provided.
Since:
2.14.0
  • Method Details

    • getFile

      public Optional<File> getFile()
      Find the first existence of the file.
      Returns:
      The first existence of the file.
    • processInputStream

      public void processInputStream(Consumer<InputStream> process) throws IOException
      The InputStream of the resolved file. This method can use the ClassLoader as fallback.
      Parameters:
      process - The logic to process the InputStream.
      Throws:
      IOException - Thrown if there's an issue creating an instance of InputStream.
    • getInputStream

      public Optional<InputStream> getInputStream() throws IOException
      Find the first existence of the file as InputStream. This method can use the ClassLoader as fallback.
      Returns:
      The InputStream of the file.
      Throws:
      IOException - Thrown if there's an issue creating an instance of InputStream.
      Since:
      2.15.0
    • getBuilder

      public static PathFinder.PathFinderBuilder getBuilder(String filename)
      The only method that can create an instance of PathFinder.
      Parameters:
      filename - The filename to find the first existence.
      Returns:
      An instance of PathFinderBuilder.