java.lang.Object
org.noise_planet.noisemodelling.emission.utils.UriUtils

public class UriUtils extends Object
  • Constructor Details

    • UriUtils

      public UriUtils()
  • Method Details

    • isValidUri

      public static boolean isValidUri(String uriString)
      Validates if a string is a well-formed URI and uses an approved scheme (http, https, or file).
      Parameters:
      uriString - the string to validate; can be null or empty
      Returns:
      true if the string is a valid URI with an allowed scheme, false otherwise
    • openSafeStream

      public static InputStream openSafeStream(String urlString) throws IOException
      Fetches a resource as an InputStream using the modern HttpClient API. This method validates the HTTP status code before returning the stream.
      Parameters:
      urlString - The full URL of the resource.
      Returns:
      An InputStream of the response body.
      Throws:
      IOException - If a network error occurs, or the server returns a non-200 code or the operation is interrupted.