Class Uri
- All Implemented Interfaces:
Proxy
GUri type and related functions can be used to parse URIs into
their components, and build valid URIs from individual components.
Since GUri only represents absolute URIs, all GUris will have a
URI scheme, so getScheme() will always return a non-NULL
answer. Likewise, by definition, all URIs have a path component, so
getPath() will always return a non-NULL string (which may
be empty).
If the URI string has an
‘authority’ component (that
is, if the scheme is followed by :// rather than just :), then the
GUri will contain a hostname, and possibly a port and ‘userinfo’.
Additionally, depending on how the GUri was constructed/parsed (for example,
using the G_URI_FLAGS_HAS_PASSWORD and G_URI_FLAGS_HAS_AUTH_PARAMS flags),
the userinfo may be split out into a username, password, and
additional authorization-related parameters.
Normally, the components of a GUri will have all %-encoded
characters decoded. However, if you construct/parse a GUri with
G_URI_FLAGS_ENCODED, then the %-encoding will be preserved instead in
the userinfo, path, and query fields (and in the host field if also
created with G_URI_FLAGS_NON_DNS). In particular, this is necessary if
the URI may contain binary data or non-UTF-8 text, or if decoding
the components might change the interpretation of the URI.
For example, with the encoded flag:
g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_ENCODED, &err);
g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue");
While the default %-decoding behaviour would give:
g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fparam%3Dvalue", G_URI_FLAGS_NONE, &err);
g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http://host/path?param=value");
During decoding, if an invalid UTF-8 string is encountered, parsing will fail with an error indicating the bad string location:
g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http%3A%2F%2Fhost%2Fpath%3Fbad%3D%00alue", G_URI_FLAGS_NONE, &err);
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_BAD_QUERY);
You should pass G_URI_FLAGS_ENCODED or G_URI_FLAGS_ENCODED_QUERY if you
need to handle that case manually. In particular, if the query string
contains = characters that are %-encoded, you should let
parseParams(java.lang.String, long, java.lang.String, java.util.Set<org.gnome.glib.UriParamsFlags>) do the decoding once of the query.
GUri is immutable once constructed, and can safely be accessed from
multiple threads. Its reference counting is atomic.
Note that the scope of GUri is to help manipulate URIs in various applications,
following RFC 3986. In particular,
it doesn't intend to cover web browser needs, and doesn’t implement the
WHATWG URL standard. No APIs are provided to
help prevent
homograph attacks, so
GUri is not suitable for formatting URIs for display to the user for making
security-sensitive decisions.
Relative and absolute URIs
As defined in RFC 3986, the
hierarchical nature of URIs means that they can either be ‘relative
references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for
clarity, ‘URIs’ are referred to in this documentation as
‘absolute URIs’ — although
in contrast to RFC 3986,
fragment identifiers are always allowed).
Relative references have one or more components of the URI missing. In
particular, they have no scheme. Any other component, such as hostname,
query, etc. may be missing, apart from a path, which has to be specified (but
may be empty). The path may be relative, starting with ./ rather than /.
For example, a valid relative reference is ./path?query,
/?query#fragment or //example.com.
Absolute URIs have a scheme specified. Any other components of the URI which
are missing are specified as explicitly unset in the URI, rather than being
resolved relative to a base URI using parseRelative(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>).
For example, a valid absolute URI is file:///home/bob or
https://search.com?query=string.
A GUri instance is always an absolute URI. A string may be an absolute URI
or a relative reference; see the documentation for individual functions as to
what forms they accept.
Parsing URIs
The most minimalist APIs for parsing URIs are split(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>) and
splitWithUser(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>). These split a URI into its component
parts, and return the parts; the difference between the two is that
split(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>) treats the ‘userinfo’ component of the URI as a
single element, while splitWithUser(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>) can (depending on the
GLib.UriFlags you pass) treat it as containing a username, password,
and authentication parameters. Alternatively, splitNetwork(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>)
can be used when you are only interested in the components that are
needed to initiate a network connection to the service (scheme,
host, and port).
parse(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>) is similar to split(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>), but instead of
returning individual strings, it returns a GUri structure (and it requires
that the URI be an absolute URI).
resolveRelative(java.lang.String, java.lang.String, java.util.Set<org.gnome.glib.UriFlags>) and parseRelative(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>) allow
you to resolve a relative URI relative to a base URI.
resolveRelative(java.lang.String, java.lang.String, java.util.Set<org.gnome.glib.UriFlags>) takes two strings and returns a string,
and parseRelative(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>) takes a GUri and a string and returns a
GUri.
All of the parsing functions take a GLib.UriFlags argument describing
exactly how to parse the URI; see the documentation for that type
for more details on the specific flags that you can pass. If you
need to choose different flags based on the type of URI, you can
use peekScheme(java.lang.String) on the URI string to check the scheme
first, and use that to decide what flags to parse it with.
For example, you might want to use G_URI_PARAMS_WWW_FORM when parsing the
params for a web URI, so compare the result of peekScheme(java.lang.String)
against http and https.
Building URIs
join(java.util.Set<org.gnome.glib.UriFlags>, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) and joinWithUser(java.util.Set<org.gnome.glib.UriFlags>, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) can be used to construct
valid URI strings from a set of component strings. They are the
inverse of split(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>) and splitWithUser(java.lang.String, java.util.Set<org.gnome.glib.UriFlags>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.Integer>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>, org.javagi.base.Out<java.lang.String>).
Similarly, build(java.util.Set<org.gnome.glib.UriFlags>, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) and buildWithUser(java.util.Set<org.gnome.glib.UriFlags>, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String) can be
used to construct a GUri from a set of component strings.
As with the parsing functions, the building functions take a
GLib.UriFlags argument. In particular, it is important to keep in mind
whether the URI components you are using are already %-encoded. If so,
you must pass the G_URI_FLAGS_ENCODED flag.
file:// URIs
Note that Windows and Unix both define special rules for parsing
file:// URIs (involving non-UTF-8 character sets on Unix, and the
interpretation of path separators on Windows). GUri does not
implement these rules. Use GLib.filenameFromUri(java.lang.String, org.javagi.base.Out<java.lang.String>) and
GLib.filenameToUri(java.lang.String, java.lang.String) if you want to properly convert between
file:// URIs and local filenames.
URI Equality
Note that there is no g_uri_equal () function, because comparing
URIs usefully requires scheme-specific knowledge that GUri does
not have. GUri can help with normalization if you use the various
encoded GLib.UriFlags as well as G_URI_FLAGS_SCHEME_NORMALIZE
however it is not comprehensive.
For example, data:,foo and data:;base64,Zm9v resolve to the same
thing according to the data: URI specification which GLib does not
handle.
- Since:
- 2.66
-
Constructor Summary
ConstructorsConstructorDescriptionUri(MemorySegment address) Create a Uri proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic Uribuild(Set<UriFlags> flags, String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags.static Uribuild(UriFlags flags, String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags.static UribuildWithUser(Set<UriFlags> flags, String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags(UriFlags.HAS_PASSWORDis added unconditionally).static UribuildWithUser(UriFlags flags, String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags(UriFlags.HAS_PASSWORDis added unconditionally).static Quarkstatic StringescapeBytes(@org.jspecify.annotations.Nullable byte @Nullable [] unescaped, @Nullable String reservedCharsAllowed) Escapes arbitrary data for use in a URI.static StringescapeString(String unescaped, @Nullable String reservedCharsAllowed, boolean allowUtf8) Escapes a string for use in a URI.@Nullable StringGetsuri'sauthentication parameters, which may contain%-encoding, depending on the flags with which this Uri was created.getFlags()Getsuri'sflags set upon construction.@Nullable StringGetsuri'sfragment, which may contain%-encoding, depending on the flags with which this Uri was created.@Nullable StringgetHost()Getsuri'shost.@Nullable StringGetsuri'spassword, which may contain%-encoding, depending on the flags with which this Uri was created.getPath()Getsuri'spath, which may contain%-encoding, depending on the flags with which this Uri was created.intgetPort()Getsuri'sport.@Nullable StringgetQuery()Getsuri'squery, which may contain%-encoding, depending on the flags with which this Uri was created.Getsuri'sscheme.static @Nullable TypegetType()Get the GType of the Uri class@Nullable StringgetUser()Gets the ‘username’ component ofuri'suserinfo, which may contain%-encoding, depending on the flags with which this Uri was created.@Nullable StringGetsuri'suserinfo, which may contain%-encoding, depending on the flags with which this Uri was created.static booleanstatic booleanstatic Stringjoin(Set<UriFlags> flags, @Nullable String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.static Stringjoin(UriFlags flags, @Nullable String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.static StringjoinWithUser(Set<UriFlags> flags, @Nullable String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.static StringjoinWithUser(UriFlags flags, @Nullable String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.static String[]listExtractUris(String uriList) Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments.static UriParsesuriStringaccording toflags.If the result is not a valid absolute URI, it will be discarded, and an error returned.static UriParsesuriStringaccording toflags.If the result is not a valid absolute URI, it will be discarded, and an error returned.parseParams(String params, long length, String separators, Set<UriParamsFlags> flags) Many URI schemes include one or more attribute/value pairs as part of the URI value.parseParams(String params, long length, String separators, UriParamsFlags... flags) Many URI schemes include one or more attribute/value pairs as part of the URI value.parseRelative(String uriRef, Set<UriFlags> flags) ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUri.If the result is not a valid absolute URI, it will be discarded, and an error returned.parseRelative(String uriRef, UriFlags... flags) ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUri.If the result is not a valid absolute URI, it will be discarded, and an error returned.static @Nullable StringparseScheme(String uri) Gets the scheme portion of a URI string.static @Nullable StringpeekScheme(String uri) Gets the scheme portion of a URI string.ref()Increments the reference count of this Uri by one.static StringresolveRelative(@Nullable String baseUriString, String uriRef, Set<UriFlags> flags) ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUriString.If the result is not a valid absolute URI, it will be discarded, and an error returned.static StringresolveRelative(@Nullable String baseUriString, String uriRef, UriFlags... flags) ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUriString.If the result is not a valid absolute URI, it will be discarded, and an error returned.static booleansplit(String uriRef, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> userinfo, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces.static booleansplit(String uriRef, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> userinfo, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces.static booleansplitNetwork(String uriString, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> host, @Nullable Out<Integer> port) ParsesuriString(which must be an absolute URI) according toflags,and returns the pieces relevant to connecting to a host.static booleansplitNetwork(String uriString, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> host, @Nullable Out<Integer> port) ParsesuriString(which must be an absolute URI) according toflags,and returns the pieces relevant to connecting to a host.static booleansplitWithUser(String uriRef, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> user, @Nullable Out<String> password, @Nullable Out<String> authParams, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces.static booleansplitWithUser(String uriRef, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> user, @Nullable Out<String> password, @Nullable Out<String> authParams, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces.toString()Returns a string representinguri.toStringPartial(Set<UriHideFlags> flags) Returns a string representinguri,subject to the options inflags.See g_uri_to_string() andGUriHideFlagsfor more details.toStringPartial(UriHideFlags... flags) Returns a string representinguri,subject to the options inflags.See g_uri_to_string() andGUriHideFlagsfor more details.static byte[]unescapeBytes(String escapedString, long length, @Nullable String illegalCharacters) Unescapes a segment of an escaped string as binary data.static @Nullable StringunescapeSegment(@Nullable String escapedString, @Nullable String escapedStringEnd, @Nullable String illegalCharacters) Unescapes a segment of an escaped string.static @Nullable StringunescapeString(String escapedString, @Nullable String illegalCharacters) Unescapes a whole escaped string.voidunref()Atomically decrements the reference count of this Uri by one.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Uri
Create a Uri proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getType
-
build
public static Uri build(Set<UriFlags> flags, String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags.See also g_uri_build_with_user(), which allows specifying the components of the "userinfo" separately.
- Parameters:
flags- flags describing how to build theGUrischeme- the URI schemeuserinfo- the userinfo component, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- a new
GUri - Since:
- 2.66
-
build
public static Uri build(UriFlags flags, String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags.See also g_uri_build_with_user(), which allows specifying the components of the "userinfo" separately.
- Parameters:
flags- flags describing how to build theGUrischeme- the URI schemeuserinfo- the userinfo component, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- a new
GUri - Since:
- 2.66
-
buildWithUser
public static Uri buildWithUser(Set<UriFlags> flags, String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags(UriFlags.HAS_PASSWORDis added unconditionally). Theflagsmust be coherent with the passed values, in particular use%-encoded values withUriFlags.ENCODED.In contrast to g_uri_build(), this allows specifying the components of the ‘userinfo’ field separately. Note that
usermust be non-nullif eitherpasswordorauthParamsis non-null.- Parameters:
flags- flags describing how to build theGUrischeme- the URI schemeuser- the user component of the userinfo, ornullpassword- the password component of the userinfo, ornullauthParams- the auth params of the userinfo, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- a new
GUri - Since:
- 2.66
-
buildWithUser
public static Uri buildWithUser(UriFlags flags, String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Creates a newGUrifrom the given components according toflags(UriFlags.HAS_PASSWORDis added unconditionally). Theflagsmust be coherent with the passed values, in particular use%-encoded values withUriFlags.ENCODED.In contrast to g_uri_build(), this allows specifying the components of the ‘userinfo’ field separately. Note that
usermust be non-nullif eitherpasswordorauthParamsis non-null.- Parameters:
flags- flags describing how to build theGUrischeme- the URI schemeuser- the user component of the userinfo, ornullpassword- the password component of the userinfo, ornullauthParams- the auth params of the userinfo, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- a new
GUri - Since:
- 2.66
-
errorQuark
-
escapeBytes
public static String escapeBytes(@org.jspecify.annotations.Nullable byte @Nullable [] unescaped, @Nullable String reservedCharsAllowed) Escapes arbitrary data for use in a URI.Normally all characters that are not ‘unreserved’ (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in
reservedCharsAllowedthey are not escaped. This is useful for the ‘reserved’ characters in the URI specification, since those are allowed unescaped in some portions of a URI.Though technically incorrect, this will also allow escaping nul bytes as
%00.- Parameters:
unescaped- the unescaped input data.reservedCharsAllowed- a string of reserved characters that are allowed to be used, ornull.- Returns:
- an escaped version of
unescaped.The returned string should be freed when no longer needed. - Since:
- 2.66
-
escapeString
public static String escapeString(String unescaped, @Nullable String reservedCharsAllowed, boolean allowUtf8) Escapes a string for use in a URI.Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical characters plus dash, dot, underscore and tilde) are escaped. But if you specify characters in
reservedCharsAllowedthey are not escaped. This is useful for the "reserved" characters in the URI specification, since those are allowed unescaped in some portions of a URI.- Parameters:
unescaped- the unescaped input string.reservedCharsAllowed- a string of reserved characters that are allowed to be used, ornull.allowUtf8-trueif the result can include UTF-8 characters.- Returns:
- an escaped version of
unescaped.The returned string should be freed when no longer needed. - Since:
- 2.16
-
isValid
ParsesuriStringaccording toflags,to determine whether it is a valid absolute URI, i.e. it does not need to be resolved relative to another URI using g_uri_parse_relative().If it’s not a valid URI, an error is returned explaining how it’s invalid.
See g_uri_split(), and the definition of
GUriFlags, for more information on the effect offlags.- Parameters:
uriString- a string containing an absolute URIflags- flags for parsinguriString- Returns:
trueifuriStringis a valid absolute URI,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
isValid
ParsesuriStringaccording toflags,to determine whether it is a valid absolute URI, i.e. it does not need to be resolved relative to another URI using g_uri_parse_relative().If it’s not a valid URI, an error is returned explaining how it’s invalid.
See g_uri_split(), and the definition of
GUriFlags, for more information on the effect offlags.- Parameters:
uriString- a string containing an absolute URIflags- flags for parsinguriString- Returns:
trueifuriStringis a valid absolute URI,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
join
public static String join(Set<UriFlags> flags, @Nullable String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.pathmay not benull(though it may be the empty string).When
hostis present,pathmust either be empty or begin with a slash (/) character. Whenhostis not present,pathcannot begin with two slash characters (//). See RFC 3986, section 3.See also g_uri_join_with_user(), which allows specifying the components of the ‘userinfo’ separately.
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSare ignored if set inflags.- Parameters:
flags- flags describing how to build the URI stringscheme- the URI scheme, ornulluserinfo- the userinfo component, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- an absolute URI string
- Since:
- 2.66
-
join
public static String join(UriFlags flags, @Nullable String scheme, @Nullable String userinfo, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.pathmay not benull(though it may be the empty string).When
hostis present,pathmust either be empty or begin with a slash (/) character. Whenhostis not present,pathcannot begin with two slash characters (//). See RFC 3986, section 3.See also g_uri_join_with_user(), which allows specifying the components of the ‘userinfo’ separately.
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSare ignored if set inflags.- Parameters:
flags- flags describing how to build the URI stringscheme- the URI scheme, ornulluserinfo- the userinfo component, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- an absolute URI string
- Since:
- 2.66
-
joinWithUser
public static String joinWithUser(Set<UriFlags> flags, @Nullable String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.pathmay not benull(though it may be the empty string).In contrast to g_uri_join(), this allows specifying the components of the ‘userinfo’ separately. It otherwise behaves the same.
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSare ignored if set inflags.- Parameters:
flags- flags describing how to build the URI stringscheme- the URI scheme, ornulluser- the user component of the userinfo, ornullpassword- the password component of the userinfo, ornullauthParams- the auth params of the userinfo, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- an absolute URI string
- Since:
- 2.66
-
joinWithUser
public static String joinWithUser(UriFlags flags, @Nullable String scheme, @Nullable String user, @Nullable String password, @Nullable String authParams, @Nullable String host, int port, String path, @Nullable String query, @Nullable String fragment) Joins the given components together according toflagsto create an absolute URI string.pathmay not benull(though it may be the empty string).In contrast to g_uri_join(), this allows specifying the components of the ‘userinfo’ separately. It otherwise behaves the same.
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSare ignored if set inflags.- Parameters:
flags- flags describing how to build the URI stringscheme- the URI scheme, ornulluser- the user component of the userinfo, ornullpassword- the password component of the userinfo, ornullauthParams- the auth params of the userinfo, ornullhost- the host component, ornullport- the port, or-1path- the path componentquery- the query component, ornullfragment- the fragment, ornull- Returns:
- an absolute URI string
- Since:
- 2.66
-
listExtractUris
Splits an URI list conforming to the text/uri-list mime type defined in RFC 2483 into individual URIs, discarding any comments. The URIs are not validated.- Parameters:
uriList- an URI list- Returns:
- a newly allocated
null-terminated list of strings holding the individual URIs. The array should be freed with g_strfreev(). - Since:
- 2.6
-
parse
ParsesuriStringaccording toflags.If the result is not a valid absolute URI, it will be discarded, and an error returned.- Parameters:
uriString- a string representing an absolute URIflags- flags describing how to parseuriString- Returns:
- a new
GUri, or NULL on error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
parse
ParsesuriStringaccording toflags.If the result is not a valid absolute URI, it will be discarded, and an error returned.- Parameters:
uriString- a string representing an absolute URIflags- flags describing how to parseuriString- Returns:
- a new
GUri, or NULL on error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
parseParams
public static HashTable<String,String> parseParams(String params, long length, String separators, Set<UriParamsFlags> flags) throws GErrorException Many URI schemes include one or more attribute/value pairs as part of the URI value. This method can be used to parse them into a hash table. When an attribute has multiple occurrences, the last value is the final returned value. If you need to handle repeated attributes differently, useGUriParamsIter.The
paramsstring is assumed to still be%-encoded, but the returned values will be fully decoded. (Thus it is possible that the returned values may contain=orseparators,if the value was encoded in the input.) Invalid%-encoding is treated as with theUriFlags.PARSE_RELAXEDrules for g_uri_parse(). (However, ifparamsis the path or query string from aGUrithat was parsed withoutUriFlags.PARSE_RELAXEDandUriFlags.ENCODED, then you already know that it does not contain any invalid encoding.)UriParamsFlags.WWW_FORMis handled as documented for g_uri_params_iter_init().If
UriParamsFlags.CASE_INSENSITIVEis passed toflags,attributes will be compared case-insensitively, so a params stringattr=123&Attr=456will only return a single attribute–value pair,Attr=456. Case will be preserved in the returned attributes.If
paramscannot be parsed (for example, it contains twoseparatorscharacters in a row), thenerroris set andnullis returned.- Parameters:
params- a%-encoded string containingattribute=valueparameterslength- the length ofparams,or-1if it is nul-terminatedseparators- the separator byte character set between parameters. (usually&, but sometimes;or both&;). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur.flags- flags to modify the way the parameters are handled.- Returns:
- A hash table of attribute/value pairs, with both names and values
fully-decoded; or
nullon error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
parseParams
public static HashTable<String,String> parseParams(String params, long length, String separators, UriParamsFlags... flags) throws GErrorException Many URI schemes include one or more attribute/value pairs as part of the URI value. This method can be used to parse them into a hash table. When an attribute has multiple occurrences, the last value is the final returned value. If you need to handle repeated attributes differently, useGUriParamsIter.The
paramsstring is assumed to still be%-encoded, but the returned values will be fully decoded. (Thus it is possible that the returned values may contain=orseparators,if the value was encoded in the input.) Invalid%-encoding is treated as with theUriFlags.PARSE_RELAXEDrules for g_uri_parse(). (However, ifparamsis the path or query string from aGUrithat was parsed withoutUriFlags.PARSE_RELAXEDandUriFlags.ENCODED, then you already know that it does not contain any invalid encoding.)UriParamsFlags.WWW_FORMis handled as documented for g_uri_params_iter_init().If
UriParamsFlags.CASE_INSENSITIVEis passed toflags,attributes will be compared case-insensitively, so a params stringattr=123&Attr=456will only return a single attribute–value pair,Attr=456. Case will be preserved in the returned attributes.If
paramscannot be parsed (for example, it contains twoseparatorscharacters in a row), thenerroris set andnullis returned.- Parameters:
params- a%-encoded string containingattribute=valueparameterslength- the length ofparams,or-1if it is nul-terminatedseparators- the separator byte character set between parameters. (usually&, but sometimes;or both&;). Note that this function works on bytes not characters, so it can't be used to delimit UTF-8 strings for anything but ASCII characters. You may pass an empty set, in which case no splitting will occur.flags- flags to modify the way the parameters are handled.- Returns:
- A hash table of attribute/value pairs, with both names and values
fully-decoded; or
nullon error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
parseScheme
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
Common schemes includeURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]file,https,svn+ssh, etc.- Parameters:
uri- a valid URI.- Returns:
- The ‘scheme’ component of the URI, or
nullon error. The returned string should be freed when no longer needed. - Since:
- 2.16
-
peekScheme
Gets the scheme portion of a URI string. RFC 3986 decodes the scheme as:
Common schemes includeURI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]file,https,svn+ssh, etc.Unlike g_uri_parse_scheme(), the returned scheme is normalized to all-lowercase and does not need to be freed.
- Parameters:
uri- a valid URI.- Returns:
- The ‘scheme’ component of the URI, or
nullon error. The returned string is normalized to all-lowercase, and interned via g_intern_string(), so it does not need to be freed. - Since:
- 2.66
-
resolveRelative
public static String resolveRelative(@Nullable String baseUriString, String uriRef, Set<UriFlags> flags) throws GErrorException ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUriString.If the result is not a valid absolute URI, it will be discarded, and an error returned.(If
baseUriStringisnull, this just returnsuriRef,ornullifuriRefis invalid or not absolute.)- Parameters:
baseUriString- a string representing a base URIuriRef- a string representing a relative or absolute URIflags- flags describing how to parseuriRef- Returns:
- the resolved URI string, or NULL on error.
- Throws:
GErrorException- seeGError- Since:
- 2.66
-
resolveRelative
public static String resolveRelative(@Nullable String baseUriString, String uriRef, UriFlags... flags) throws GErrorException ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUriString.If the result is not a valid absolute URI, it will be discarded, and an error returned.(If
baseUriStringisnull, this just returnsuriRef,ornullifuriRefis invalid or not absolute.)- Parameters:
baseUriString- a string representing a base URIuriRef- a string representing a relative or absolute URIflags- flags describing how to parseuriRef- Returns:
- the resolved URI string, or NULL on error.
- Throws:
GErrorException- seeGError- Since:
- 2.66
-
split
public static boolean split(String uriRef, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> userinfo, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) throws GErrorException ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces. Any component that doesn't appear inuriRefwill be returned asnull(but note that all URIs always have a path component, though it may be the empty string).If
flagscontainsUriFlags.ENCODED, then%-encoded characters inuriRefwill remain encoded in the output strings. (If not, then all such characters will be decoded.) Note that decoding will only work if the URI components are ASCII or UTF-8, so you will need to useUriFlags.ENCODEDif they are not.Note that the
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSflagsare ignored by g_uri_split(), since it always returns only the full userinfo; use g_uri_split_with_user() if you want it split up.- Parameters:
uriRef- a string containing a relative or absolute URIflags- flags for parsinguriRefscheme- on return, contains the scheme (converted to lowercase), ornulluserinfo- on return, contains the userinfo, ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1path- on return, contains the pathquery- on return, contains the query, ornullfragment- on return, contains the fragment, ornull- Returns:
trueifuriRefparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
split
public static boolean split(String uriRef, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> userinfo, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) throws GErrorException ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces. Any component that doesn't appear inuriRefwill be returned asnull(but note that all URIs always have a path component, though it may be the empty string).If
flagscontainsUriFlags.ENCODED, then%-encoded characters inuriRefwill remain encoded in the output strings. (If not, then all such characters will be decoded.) Note that decoding will only work if the URI components are ASCII or UTF-8, so you will need to useUriFlags.ENCODEDif they are not.Note that the
UriFlags.HAS_PASSWORDandUriFlags.HAS_AUTH_PARAMSflagsare ignored by g_uri_split(), since it always returns only the full userinfo; use g_uri_split_with_user() if you want it split up.- Parameters:
uriRef- a string containing a relative or absolute URIflags- flags for parsinguriRefscheme- on return, contains the scheme (converted to lowercase), ornulluserinfo- on return, contains the userinfo, ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1path- on return, contains the pathquery- on return, contains the query, ornullfragment- on return, contains the fragment, ornull- Returns:
trueifuriRefparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
splitNetwork
public static boolean splitNetwork(String uriString, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> host, @Nullable Out<Integer> port) throws GErrorException ParsesuriString(which must be an absolute URI) according toflags,and returns the pieces relevant to connecting to a host. See the documentation for g_uri_split() for more details; this is mostly a wrapper around that function with simpler arguments. However, it will return an error ifuriStringis a relative URI, or does not contain a hostname component.- Parameters:
uriString- a string containing an absolute URIflags- flags for parsinguriStringscheme- on return, contains the scheme (converted to lowercase), ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1- Returns:
trueifuriStringparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
splitNetwork
public static boolean splitNetwork(String uriString, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> host, @Nullable Out<Integer> port) throws GErrorException ParsesuriString(which must be an absolute URI) according toflags,and returns the pieces relevant to connecting to a host. See the documentation for g_uri_split() for more details; this is mostly a wrapper around that function with simpler arguments. However, it will return an error ifuriStringis a relative URI, or does not contain a hostname component.- Parameters:
uriString- a string containing an absolute URIflags- flags for parsinguriStringscheme- on return, contains the scheme (converted to lowercase), ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1- Returns:
trueifuriStringparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
splitWithUser
public static boolean splitWithUser(String uriRef, Set<UriFlags> flags, @Nullable Out<String> scheme, @Nullable Out<String> user, @Nullable Out<String> password, @Nullable Out<String> authParams, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) throws GErrorException ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces. Any component that doesn't appear inuriRefwill be returned asnull(but note that all URIs always have a path component, though it may be the empty string).See g_uri_split(), and the definition of
GUriFlags, for more information on the effect offlags.Note thatpasswordwill only be parsed out ifflagscontainsUriFlags.HAS_PASSWORD, andauthParamswill only be parsed out ifflagscontainsUriFlags.HAS_AUTH_PARAMS.- Parameters:
uriRef- a string containing a relative or absolute URIflags- flags for parsinguriRefscheme- on return, contains the scheme (converted to lowercase), ornulluser- on return, contains the user, ornullpassword- on return, contains the password, ornullauthParams- on return, contains the auth_params, ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1path- on return, contains the pathquery- on return, contains the query, ornullfragment- on return, contains the fragment, ornull- Returns:
trueifuriRefparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
splitWithUser
public static boolean splitWithUser(String uriRef, UriFlags flags, @Nullable Out<String> scheme, @Nullable Out<String> user, @Nullable Out<String> password, @Nullable Out<String> authParams, @Nullable Out<String> host, @Nullable Out<Integer> port, @Nullable Out<String> path, @Nullable Out<String> query, @Nullable Out<String> fragment) throws GErrorException ParsesuriRef(which can be an absolute or relative URI) according toflags,and returns the pieces. Any component that doesn't appear inuriRefwill be returned asnull(but note that all URIs always have a path component, though it may be the empty string).See g_uri_split(), and the definition of
GUriFlags, for more information on the effect offlags.Note thatpasswordwill only be parsed out ifflagscontainsUriFlags.HAS_PASSWORD, andauthParamswill only be parsed out ifflagscontainsUriFlags.HAS_AUTH_PARAMS.- Parameters:
uriRef- a string containing a relative or absolute URIflags- flags for parsinguriRefscheme- on return, contains the scheme (converted to lowercase), ornulluser- on return, contains the user, ornullpassword- on return, contains the password, ornullauthParams- on return, contains the auth_params, ornullhost- on return, contains the host, ornullport- on return, contains the port, or-1path- on return, contains the pathquery- on return, contains the query, ornullfragment- on return, contains the fragment, ornull- Returns:
trueifuriRefparsed successfully,falseon error.- Throws:
GErrorException- seeGError- Since:
- 2.66
-
unescapeBytes
public static byte[] unescapeBytes(String escapedString, long length, @Nullable String illegalCharacters) throws GErrorException Unescapes a segment of an escaped string as binary data.Note that in contrast to g_uri_unescape_string(), this does allow nul bytes to appear in the output.
If any of the characters in
illegalCharactersappears as an escaped character inescapedString,then that is an error andnullwill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.- Parameters:
escapedString- A URI-escaped stringlength- the length (in bytes) ofescapedStringto escape, or-1if it is nul-terminated.illegalCharacters- a string of illegal characters not to be allowed, ornull.- Returns:
- an unescaped version of
escapedStringornullon error (if decoding failed, usingUriError.FAILEDerror code). The returnedGBytesshould be unreffed when no longer needed. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
unescapeSegment
public static @Nullable String unescapeSegment(@Nullable String escapedString, @Nullable String escapedStringEnd, @Nullable String illegalCharacters) Unescapes a segment of an escaped string.If any of the characters in
illegalCharactersor the NUL character appears as an escaped character inescapedString,then that is an error andnullwill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.Note:
NULbyte is not accepted in the output, in contrast to g_uri_unescape_bytes().- Parameters:
escapedString- A string, may benullescapedStringEnd- Pointer to end ofescapedString,may benullillegalCharacters- An optional string of illegal characters not to be allowed, may benull- Returns:
- an unescaped version of
escapedString,ornullon error. The returned string should be freed when no longer needed. As a special case ifnullis given forescapedString,this function will returnnull. - Since:
- 2.16
-
unescapeString
public static @Nullable String unescapeString(String escapedString, @Nullable String illegalCharacters) Unescapes a whole escaped string.If any of the characters in
illegalCharactersor the NUL character appears as an escaped character inescapedString,then that is an error andnullwill be returned. This is useful if you want to avoid for instance having a slash being expanded in an escaped path element, which might confuse pathname handling.- Parameters:
escapedString- an escaped string to be unescaped.illegalCharacters- a string of illegal characters not to be allowed, ornull.- Returns:
- an unescaped version of
escapedString.The returned string should be freed when no longer needed. - Since:
- 2.16
-
getAuthParams
Getsuri'sauthentication parameters, which may contain%-encoding, depending on the flags with which this Uri was created. (If this Uri was not created withUriFlags.HAS_AUTH_PARAMSthen this will benull.)Depending on the URI scheme, g_uri_parse_params() may be useful for further parsing this information.
- Returns:
uri'sauthentication parameters.- Since:
- 2.66
-
getFlags
-
getFragment
Getsuri'sfragment, which may contain%-encoding, depending on the flags with which this Uri was created.- Returns:
uri'sfragment.- Since:
- 2.66
-
getHost
Getsuri'shost. This will never have%-encoded characters, unless it is non-UTF-8 (which can only be the case if this Uri was created withUriFlags.NON_DNS).If this Uri contained an IPv6 address literal, this value will be just that address, without the brackets around it that are necessary in the string form of the URI. Note that in this case there may also be a scope ID attached to the address. Eg,
fe80::1234%em1(orfe80::1234%25em1if the string is still encoded).- Returns:
uri'shost.- Since:
- 2.66
-
getPassword
Getsuri'spassword, which may contain%-encoding, depending on the flags with which this Uri was created. (If this Uri was not created withUriFlags.HAS_PASSWORDthen this will benull.)- Returns:
uri'spassword.- Since:
- 2.66
-
getPath
Getsuri'spath, which may contain%-encoding, depending on the flags with which this Uri was created.- Returns:
uri'spath.- Since:
- 2.66
-
getPort
public int getPort()Getsuri'sport.- Returns:
uri'sport, or-1if no port was specified.- Since:
- 2.66
-
getQuery
Getsuri'squery, which may contain%-encoding, depending on the flags with which this Uri was created.For queries consisting of a series of
name=valueparameters,GUriParamsIteror g_uri_parse_params() may be useful.- Returns:
uri'squery.- Since:
- 2.66
-
getScheme
Getsuri'sscheme. Note that this will always be all-lowercase, regardless of the string or strings that this Uri was created from.- Returns:
uri'sscheme.- Since:
- 2.66
-
getUser
Gets the ‘username’ component ofuri'suserinfo, which may contain%-encoding, depending on the flags with which this Uri was created. If this Uri was not created withUriFlags.HAS_PASSWORDorUriFlags.HAS_AUTH_PARAMS, this is the same as g_uri_get_userinfo().- Returns:
uri'suser.- Since:
- 2.66
-
getUserinfo
Getsuri'suserinfo, which may contain%-encoding, depending on the flags with which this Uri was created.- Returns:
uri'suserinfo.- Since:
- 2.66
-
parseRelative
ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUri.If the result is not a valid absolute URI, it will be discarded, and an error returned.- Parameters:
uriRef- a string representing a relative or absolute URIflags- flags describing how to parseuriRef- Returns:
- a new
GUri, or NULL on error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
parseRelative
ParsesuriRefaccording toflagsand, if it is a relative URI, resolves it relative tobaseUri.If the result is not a valid absolute URI, it will be discarded, and an error returned.- Parameters:
uriRef- a string representing a relative or absolute URIflags- flags describing how to parseuriRef- Returns:
- a new
GUri, or NULL on error. - Throws:
GErrorException- seeGError- Since:
- 2.66
-
ref
-
toString
Returns a string representinguri.This is not guaranteed to return a string which is identical to the string that this Uri was parsed from. However, if the source URI was syntactically correct (according to RFC 3986), and it was parsed with
UriFlags.ENCODED, then g_uri_to_string() is guaranteed to return a string which is at least semantically equivalent to the source URI (according to RFC 3986).If this Uri might contain sensitive details, such as authentication parameters, or private data in its query string, and the returned string is going to be logged, then consider using g_uri_to_string_partial() to redact parts.
-
toStringPartial
Returns a string representinguri,subject to the options inflags.See g_uri_to_string() andGUriHideFlagsfor more details.- Parameters:
flags- flags describing what parts of this Uri to hide- Returns:
- a string representing
uri,which the caller must free. - Since:
- 2.66
-
toStringPartial
Returns a string representinguri,subject to the options inflags.See g_uri_to_string() andGUriHideFlagsfor more details.- Parameters:
flags- flags describing what parts of this Uri to hide- Returns:
- a string representing
uri,which the caller must free. - Since:
- 2.66
-
unref
public void unref()Atomically decrements the reference count of this Uri by one.When the reference count reaches zero, the resources allocated by this Uri are freed
- Since:
- 2.66
-