Class UriUtils
java.lang.Object
dev.langchain4j.internal.UriUtils
Utility class for URI operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic URIcreateUriSafely(String uriString) Creates a URI from the given string, handling illegal characters safely.
-
Method Details
-
createUriSafely
Creates a URI from the given string, handling illegal characters safely.This method first attempts to create a URI directly. If that fails due to illegal characters (such as spaces, non-ASCII characters, or characters like
|), it will percent-encode only the illegal characters while preserving URL structural characters (:,/, etc.).If the input is null or blank, this method returns null. If the URI cannot be created even after encoding, null is returned.
- Parameters:
uriString- the input string to convert to a URI- Returns:
- a URI object, or null if the input is null, blank, or cannot be parsed
-