Package de.aristaflow.adept2.util
Class UriTools
- java.lang.Object
-
- de.aristaflow.adept2.util.UriTools
-
public class UriTools extends Object
Some useful methods forURIs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetStringContent(URI uri)Loads the content of the designated URI, interprets it as UTF-8 string and returns the complete string (including line breaks).static StringgetStringFromURIs(URI[] uris, Logger logger)Convert an array of URIs to a string with special separator characters (%|).static URI[]getURIsFromString(String string, Logger logger)Convert a string with special separator characters (%|) to an array of URIs.
-
-
-
Field Detail
-
SEPARATOR
protected static final String SEPARATOR
The separator for the URIs in an URI[], which will be stored as string.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
nullin case ofnullor 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 (viaURL) or retrieving the content, anIOExceptionwill be thrown.
-
-