Package de.murmelmeister.library.utils
Class URLUtils
java.lang.Object
de.murmelmeister.library.utils.URLUtils
Utility class for handling URL-related operations.
Provides methods to fetch content from a URL as a string.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
URLUtils
public URLUtils()
-
-
Method Details
-
getText
Fetches the content of the resource located at the specified URL as a string. Opens an HTTP connection to the given URL, retrieves the response content, and returns it as a string. In the case of an error response, the error stream content is returned.- Parameters:
url- The URL of the resource to fetch content from- Returns:
- The content of the resource as a string
- Throws:
IOException- If an I/O exception occurs while opening the connection or reading from itURISyntaxException- If the provided URL is not a valid URI
-