Class ResourceResolution

java.lang.Object
com.illumon.util.files.ResourceResolution

public class ResourceResolution
extends Object
  • Constructor Summary

    Constructors 
    Constructor Description
    ResourceResolution​(com.fishlib.configuration.Configuration configuration, String delimiterRegex, String... delimitedResourceList)
    An instance of this class should be created to contain the required parameters to use for the resource search
  • Method Summary

    Modifier and Type Method Description
    void findResources​(String suffix, BiConsumer<URL,​String> consumer)
    Find all resources associated with a list of resources
    protected String normalize​(String resourcePath)
    Replace multiple sequential file separators (either Windows or Unix) with single instances of the system file separator.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResourceResolution

      public ResourceResolution​(@NotNull com.fishlib.configuration.Configuration configuration, String delimiterRegex, @NotNull String... delimitedResourceList)
      An instance of this class should be created to contain the required parameters to use for the resource search
      Parameters:
      configuration - configuration to be used for resource resolution
      delimiterRegex - regular expression to be used to delimit the resources; if it is null or has a length of 0 then the default (semicolon or space) will be used
      delimitedResourceList - list of resources to find, delimited by delimiterRegex. These resources can include files and directories. There can be many of these.
  • Method Details

    • findResources

      public void findResources​(@NotNull String suffix, @NotNull BiConsumer<URL,​String> consumer) throws IOException
      Find all resources associated with a list of resources
      Parameters:
      suffix - filename suffix to be searched for
      consumer - operation to perform on each found resource (URL, file name pair)
      Throws:
      IOException - in the event of issues opening files or malformed URLs; this should not occur unless files are being modified as we walk the directories
    • normalize

      protected String normalize​(String resourcePath)
      Replace multiple sequential file separators (either Windows or Unix) with single instances of the system file separator. Make sure UNC paths are preserved by leaving two leading file sparator characters in place
      Parameters:
      resourcePath - the path to normalize
      Returns:
      the normalized path