Class Util


  • public class Util
    extends Object
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • getResourceOrFile

        public static InputStream getResourceOrFile​(String name)
                                             throws IOException
        Open a stream from a resource or a file. If a file with the given name exists then return a stream from that file, otherwise try to open it as a system resource.
        Parameters:
        name - The name of the resource or file.
        Throws:
        IOException
      • replacePrefix

        public static String replacePrefix​(String value,
                                           String[] prefixes)
        Replace one prefix string with another. This is used, e.g., to replace URLs with local file access.
        Parameters:
        value - The string to be modifed.
        prefixes - A 2 element array where we will look for the first prefix at the beginning of value and if found replace it with the second prefix.
        Returns:
        The string with the prefix replaced if found.