Class UriTools

java.lang.Object
de.aristaflow.adept2.util.UriTools

public class UriTools extends Object
Some useful methods for URIs.
  • Field Details

    • SEPARATOR

      protected static final String SEPARATOR
      The separator for the URIs in an URI[], which will be stored as string.
      See Also:
  • Method Details

    • getStringFromURIs

      public static String getStringFromURIs(URI[] uris, Logger logger)
      Convert an array of URIs to a string with special separator characters (%|).
      Parameters:
      uris - The array of URIs that should be converted.
      logger - The logger for log messages.
      Returns:
      A string representing the URI array or null in case of null or an empty array.
    • getURIsFromString

      public static URI[] getURIsFromString(String string, Logger logger) throws URISyntaxException
      Convert a string with special separator characters (%|) to an array of URIs.
      Parameters:
      string - The string that should be converted.
      logger - The logger for log messages.
      Returns:
      An array of URIs.
      Throws:
      URISyntaxException - If problems occur during the (re-)creation of the URIs.
    • getStringContent

      public static String getStringContent(URI uri) throws IOException
      Loads the content of the designated URI, interprets it as UTF-8 string and returns the complete string (including line breaks).
      Parameters:
      uri - The URI from which to load string content (UTF-8-encoded).
      Returns:
      The string content retrieved from the designated URI.
      Throws:
      IOException - If there are problems connecting to the URI (via URL) or retrieving the content, an IOException will be thrown.