Klasse Uri

Alle implementierten Schnittstellen:
PointerInterface

public class Uri extends Record
A #GstUri object can be used to parse and split a URI string into its
constituent parts. Two #GstUri objects can be joined to make a new #GstUri
using the algorithm described in RFC3986.

https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html

  • Konstruktordetails

    • Uri

      public Uri(PointerContainer pointer)
    • Uri

      public Uri(@Nullable Str scheme, @Nullable Str userinfo, @Nullable Str host, int port, @Nullable Str path, @Nullable Str query, @Nullable Str fragment)
      Creates a new #GstUri object with the given URI parts. The path and query
      strings will be broken down into their elements. All strings should not be
      escaped except where indicated.
      Parameter:
      scheme - The scheme for the new URI.
      userinfo - The user-info for the new URI.
      host - The host name for the new URI.
      port - The port number for the new URI or %GST_URI_NO_PORT.
      path - The path for the new URI with '/' separating path elements.
      query - The query string for the new URI with '&' separating query elements. Elements containing '&' characters should encode them as "%26".
      fragment - The fragment name for the new URI.
    • Uri

      public Uri(String scheme, String userinfo, String host, int port, String path, String query, String fragment)
      Creates a new #GstUri object with the given URI parts. The path and query
      strings will be broken down into their elements. All strings should not be
      escaped except where indicated.
      Parameter:
      scheme - The scheme for the new URI.
      userinfo - The user-info for the new URI.
      host - The host name for the new URI.
      port - The port number for the new URI or %GST_URI_NO_PORT.
      path - The path for the new URI with '/' separating path elements.
      query - The query string for the new URI with '&' separating query elements. Elements containing '&' characters should encode them as "%26".
      fragment - The fragment name for the new URI.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • appendPath

      public boolean appendPath(@Nullable Str relative_path)
      Append a path onto the end of the path in the URI. The path is not
      normalized, call #gst_uri_normalize() to normalize the path.
      Parameter:
      relative_path - Relative path to append to the end of the current path.
      Gibt zurück:
      %TRUE if the path was appended successfully.
    • appendPath

      public boolean appendPath(String relative_path)
      Append a path onto the end of the path in the URI. The path is not
      normalized, call #gst_uri_normalize() to normalize the path.
      Parameter:
      relative_path - Relative path to append to the end of the current path.
      Gibt zurück:
      %TRUE if the path was appended successfully.
    • appendPathSegment

      public boolean appendPathSegment(@Nullable Str path_segment)
      Append a single path segment onto the end of the URI path.
      Parameter:
      path_segment - The path segment string to append to the URI path.
      Gibt zurück:
      %TRUE if the path was appended successfully.
    • appendPathSegment

      public boolean appendPathSegment(String path_segment)
      Append a single path segment onto the end of the URI path.
      Parameter:
      path_segment - The path segment string to append to the URI path.
      Gibt zurück:
      %TRUE if the path was appended successfully.
    • equal

      public boolean equal(@Nonnull Uri second)
      Compares two #GstUri objects to see if they represent the same normalized
      URI.
      Parameter:
      second - Second #GstUri to compare.
      Gibt zurück:
      %TRUE if the normalized versions of the two URI's would be equal.
    • fromStringWithBase

      public Uri fromStringWithBase(@Nonnull Str uri)
      Like gst_uri_from_string() but also joins with a base URI.
      Parameter:
      uri - The URI string to parse.
      Gibt zurück:
      A new #GstUri object.
    • fromStringWithBase

      public Uri fromStringWithBase(String uri)
      Like gst_uri_from_string() but also joins with a base URI.
      Parameter:
      uri - The URI string to parse.
      Gibt zurück:
      A new #GstUri object.
    • getFragment

      public Str getFragment()
      Get the fragment name from the URI or %NULL if it doesn't exist.
      If @uri is %NULL then returns %NULL.
      Gibt zurück:
      The host name from the #GstUri object or %NULL.
    • getHost

      public Str getHost()
      Get the host name from the URI or %NULL if it doesn't exist.
      If @uri is %NULL then returns %NULL.
      Gibt zurück:
      The host name from the #GstUri object or %NULL.
    • getMediaFragmentTable

      public HashTable getMediaFragmentTable()
      Get the media fragment table from the URI, as defined by "Media Fragments URI 1.0".
      Hash table returned by this API is a list of "key-value" pairs, and the each
      pair is generated by splitting "URI fragment" per "&" sub-delims, then "key"
      and "value" are split by "=" sub-delims. The "key" returned by this API may
      be undefined keyword by standard.
      A value may be %NULL to indicate that the key should appear in the fragment
      string in the URI, but does not have a value. Free the returned #GHashTable
      with #g_hash_table_unref() when it is no longer required.
      Modifying this hash table does not affect the fragment in the URI.

      See more about Media Fragments URI 1.0 (W3C) at https://www.w3.org/TR/media-frags/
      Gibt zurück:
      The fragment hash table from the URI.
    • getPath

      public Str getPath()
      Extract the path string from the URI object.
      Gibt zurück:
      The path from the URI. Once finished with the string should be g_free()'d.
    • getPathSegments

      public List getPathSegments()
      Get a list of path segments from the URI.
      Gibt zurück:
      A #GList of path segment strings or %NULL if no path segments are available. Free the list when no longer needed with g_list_free_full(list, g_free).
    • getPathString

      public Str getPathString()
      Extract the path string from the URI object as a percent encoded URI path.
      Gibt zurück:
      The path from the URI. Once finished with the string should be g_free()'d.
    • getPort

      public int getPort()
      Get the port number from the URI or %GST_URI_NO_PORT if it doesn't exist.
      If @uri is %NULL then returns %GST_URI_NO_PORT.
      Gibt zurück:
      The port number from the #GstUri object or %GST_URI_NO_PORT.
    • getQueryKeys

      public List getQueryKeys()
      Get a list of the query keys from the URI.
      Gibt zurück:
      A list of keys from the URI query. Free the list with g_list_free().
    • getQueryString

      public Str getQueryString()
      Get a percent encoded URI query string from the @uri.
      Gibt zurück:
      A percent encoded query string. Use g_free() when no longer needed.
    • getQueryStringOrdered

      public Str getQueryStringOrdered(@Nullable List keys)
      Get a percent encoded URI query string from the @uri, with query parameters
      in the order provided by the @keys list. Only parameter keys in the list will
      be added to the resulting URI string. This method can be used by retrieving
      the keys with gst_uri_get_query_keys() and then sorting the list, for
      example.
      Parameter:
      keys - A GList containing the query argument key strings.
      Gibt zurück:
      A percent encoded query string. Use g_free() when no longer needed.
    • getQueryTable

      public HashTable getQueryTable()
      Get the query table from the URI. Keys and values in the table are freed
      with g_free when they are deleted. A value may be %NULL to indicate that
      the key should appear in the query string in the URI, but does not have a
      value. Free the returned #GHashTable with #g_hash_table_unref() when it is
      no longer required. Modifying this hash table will modify the query in the
      URI.
      Gibt zurück:
      The query hash table from the URI.
    • getQueryValue

      public Str getQueryValue(@Nonnull Str query_key)
      Get the value associated with the @query_key key. Will return %NULL if the
      key has no value or if the key does not exist in the URI query table. Because
      %NULL is returned for both missing keys and keys with no value, you should
      use gst_uri_query_has_key() to determine if a key is present in the URI
      query.
      Parameter:
      query_key - The key to lookup.
      Gibt zurück:
      The value for the given key, or %NULL if not found.
    • getQueryValue

      public Str getQueryValue(String query_key)
      Get the value associated with the @query_key key. Will return %NULL if the
      key has no value or if the key does not exist in the URI query table. Because
      %NULL is returned for both missing keys and keys with no value, you should
      use gst_uri_query_has_key() to determine if a key is present in the URI
      query.
      Parameter:
      query_key - The key to lookup.
      Gibt zurück:
      The value for the given key, or %NULL if not found.
    • getScheme

      public Str getScheme()
      Get the scheme name from the URI or %NULL if it doesn't exist.
      If @uri is %NULL then returns %NULL.
      Gibt zurück:
      The scheme from the #GstUri object or %NULL.
    • getUserinfo

      public Str getUserinfo()
      Get the userinfo (usually in the form "username:password") from the URI
      or %NULL if it doesn't exist. If @uri is %NULL then returns %NULL.
      Gibt zurück:
      The userinfo from the #GstUri object or %NULL.
    • isNormalized

      public boolean isNormalized()
      Tests the @uri to see if it is normalized. A %NULL @uri is considered to be
      normalized.
      Gibt zurück:
      TRUE if the URI is normalized or is %NULL.
    • isWritable

      public boolean isWritable()
      Check if it is safe to write to this #GstUri.

      Check if the refcount of @uri is exactly 1, meaning that no other
      reference exists to the #GstUri and that the #GstUri is therefore writable.

      Modification of a #GstUri should only be done after verifying that it is
      writable.
      Gibt zurück:
      %TRUE if it is safe to write to the object.
    • join

      public Uri join(@Nullable Uri ref_uri)
      Join a reference URI onto a base URI using the method from RFC 3986.
      If either URI is %NULL then the other URI will be returned with the ref count
      increased.
      Parameter:
      ref_uri - The reference URI to join onto the base URI.
      Gibt zurück:
      A #GstUri which represents the base with the reference URI joined on.
    • makeWritable

      public Uri makeWritable()
      Make the #GstUri writable.

      Checks if @uri is writable, and if so the original object is returned. If
      not, then a writable copy is made and returned. This gives away the
      reference to @uri and returns a reference to the new #GstUri.
      If @uri is %NULL then %NULL is returned.
      Gibt zurück:
      A writable version of @uri.
    • newWithBase

      public Uri newWithBase(@Nullable Str scheme, @Nullable Str userinfo, @Nullable Str host, int port, @Nullable Str path, @Nullable Str query, @Nullable Str fragment)
      Like gst_uri_new(), but joins the new URI onto a base URI.
      Parameter:
      scheme - The scheme for the new URI.
      userinfo - The user-info for the new URI.
      host - The host name for the new URI.
      port - The port number for the new URI or %GST_URI_NO_PORT.
      path - The path for the new URI with '/' separating path elements.
      query - The query string for the new URI with '&' separating query elements. Elements containing '&' characters should encode them as "%26".
      fragment - The fragment name for the new URI.
      Gibt zurück:
      The new URI joined onto @base.
    • newWithBase

      public Uri newWithBase(String scheme, String userinfo, String host, int port, String path, String query, String fragment)
      Like gst_uri_new(), but joins the new URI onto a base URI.
      Parameter:
      scheme - The scheme for the new URI.
      userinfo - The user-info for the new URI.
      host - The host name for the new URI.
      port - The port number for the new URI or %GST_URI_NO_PORT.
      path - The path for the new URI with '/' separating path elements.
      query - The query string for the new URI with '&' separating query elements. Elements containing '&' characters should encode them as "%26".
      fragment - The fragment name for the new URI.
      Gibt zurück:
      The new URI joined onto @base.
    • normalize

      public boolean normalize()
      Normalization will remove extra path segments ("." and "..") from the URI. It
      will also convert the scheme and host name to lower case and any
      percent-encoded values to uppercase.

      The #GstUri object must be writable. Check with gst_uri_is_writable() or use
      gst_uri_make_writable() first.
      Gibt zurück:
      TRUE if the URI was modified.
    • queryHasKey

      public boolean queryHasKey(@Nonnull Str query_key)
      Check if there is a query table entry for the @query_key key.
      Parameter:
      query_key - The key to lookup.
      Gibt zurück:
      %TRUE if @query_key exists in the URI query table.
    • queryHasKey

      public boolean queryHasKey(String query_key)
      Check if there is a query table entry for the @query_key key.
      Parameter:
      query_key - The key to lookup.
      Gibt zurück:
      %TRUE if @query_key exists in the URI query table.
    • removeQueryKey

      public boolean removeQueryKey(@Nonnull Str query_key)
      Remove an entry from the query table by key.
      Parameter:
      query_key - The key to remove.
      Gibt zurück:
      %TRUE if the key existed in the table and was removed.
    • removeQueryKey

      public boolean removeQueryKey(String query_key)
      Remove an entry from the query table by key.
      Parameter:
      query_key - The key to remove.
      Gibt zurück:
      %TRUE if the key existed in the table and was removed.
    • setFragment

      public boolean setFragment(@Nullable Str fragment)
      Sets the fragment string in the URI. Use a value of %NULL in @fragment to
      unset the fragment string.
      Parameter:
      fragment - The fragment string to set.
      Gibt zurück:
      %TRUE if the fragment was set/unset successfully.
    • setFragment

      public boolean setFragment(String fragment)
      Sets the fragment string in the URI. Use a value of %NULL in @fragment to
      unset the fragment string.
      Parameter:
      fragment - The fragment string to set.
      Gibt zurück:
      %TRUE if the fragment was set/unset successfully.
    • setHost

      public boolean setHost(@Nonnull Str host)
      Set or unset the host for the URI.
      Parameter:
      host - The new host string to set or %NULL to unset.
      Gibt zurück:
      %TRUE if the host was set/unset successfully.
    • setHost

      public boolean setHost(String host)
      Set or unset the host for the URI.
      Parameter:
      host - The new host string to set or %NULL to unset.
      Gibt zurück:
      %TRUE if the host was set/unset successfully.
    • setPath

      public boolean setPath(@Nullable Str path)
      Sets or unsets the path in the URI.
      Parameter:
      path - The new path to set with path segments separated by '/', or use %NULL to unset the path.
      Gibt zurück:
      %TRUE if the path was set successfully.
    • setPath

      public boolean setPath(String path)
      Sets or unsets the path in the URI.
      Parameter:
      path - The new path to set with path segments separated by '/', or use %NULL to unset the path.
      Gibt zurück:
      %TRUE if the path was set successfully.
    • setPathSegments

      public boolean setPathSegments(@Nullable List path_segments)
      Replace the path segments list in the URI.
      Parameter:
      path_segments - The new path list to set.
      Gibt zurück:
      %TRUE if the path segments were set successfully.
    • setPathString

      public boolean setPathString(@Nonnull Str path)
      Sets or unsets the path in the URI.
      Parameter:
      path - The new percent encoded path to set with path segments separated by '/', or use %NULL to unset the path.
      Gibt zurück:
      %TRUE if the path was set successfully.
    • setPathString

      public boolean setPathString(String path)
      Sets or unsets the path in the URI.
      Parameter:
      path - The new percent encoded path to set with path segments separated by '/', or use %NULL to unset the path.
      Gibt zurück:
      %TRUE if the path was set successfully.
    • setPort

      public boolean setPort(int port)
      Set or unset the port number for the URI.
      Parameter:
      port - The new port number to set or %GST_URI_NO_PORT to unset.
      Gibt zurück:
      %TRUE if the port number was set/unset successfully.
    • setQueryString

      public boolean setQueryString(@Nullable Str query)
      Sets or unsets the query table in the URI.
      Parameter:
      query - The new percent encoded query string to use to populate the query table, or use %NULL to unset the query table.
      Gibt zurück:
      %TRUE if the query table was set successfully.
    • setQueryString

      public boolean setQueryString(String query)
      Sets or unsets the query table in the URI.
      Parameter:
      query - The new percent encoded query string to use to populate the query table, or use %NULL to unset the query table.
      Gibt zurück:
      %TRUE if the query table was set successfully.
    • setQueryTable

      public boolean setQueryTable(@Nullable HashTable query_table)
      Set the query table to use in the URI. The old table is unreferenced and a
      reference to the new one is used instead. A value if %NULL for @query_table
      will remove the query string from the URI.
      Parameter:
      query_table - The new query table to use.
      Gibt zurück:
      %TRUE if the new table was successfully used for the query table.
    • setQueryValue

      public boolean setQueryValue(@Nonnull Str query_key, @Nullable Str query_value)
      This inserts or replaces a key in the query table. A @query_value of %NULL
      indicates that the key has no associated value, but will still be present in
      the query string.
      Parameter:
      query_key - The key for the query entry.
      query_value - The value for the key.
      Gibt zurück:
      %TRUE if the query table was successfully updated.
    • setQueryValue

      public boolean setQueryValue(String query_key, String query_value)
      This inserts or replaces a key in the query table. A @query_value of %NULL
      indicates that the key has no associated value, but will still be present in
      the query string.
      Parameter:
      query_key - The key for the query entry.
      query_value - The value for the key.
      Gibt zurück:
      %TRUE if the query table was successfully updated.
    • setScheme

      public boolean setScheme(@Nonnull Str scheme)
      Set or unset the scheme for the URI.
      Parameter:
      scheme - The new scheme to set or %NULL to unset the scheme.
      Gibt zurück:
      %TRUE if the scheme was set/unset successfully.
    • setScheme

      public boolean setScheme(String scheme)
      Set or unset the scheme for the URI.
      Parameter:
      scheme - The new scheme to set or %NULL to unset the scheme.
      Gibt zurück:
      %TRUE if the scheme was set/unset successfully.
    • setUserinfo

      public boolean setUserinfo(@Nonnull Str userinfo)
      Set or unset the user information for the URI.
      Parameter:
      userinfo - The new user-information string to set or %NULL to unset.
      Gibt zurück:
      %TRUE if the user information was set/unset successfully.
    • setUserinfo

      public boolean setUserinfo(String userinfo)
      Set or unset the user information for the URI.
      Parameter:
      userinfo - The new user-information string to set or %NULL to unset.
      Gibt zurück:
      %TRUE if the user information was set/unset successfully.
    • toStr

      public Str toStr()
      Convert the URI to a string.

      Returns the URI as held in this object as a #gchar* nul-terminated string.
      The caller should g_free() the string once they are finished with it.
      The string is put together as described in RFC 3986.
      Gibt zurück:
      The string version of the URI.
    • toStringWithKeys

      public Str toStringWithKeys(@Nullable List keys)
      Convert the URI to a string, with the query arguments in a specific order.
      Only the keys in the @keys list will be added to the resulting string.

      Returns the URI as held in this object as a #gchar* nul-terminated string.
      The caller should g_free() the string once they are finished with it.
      The string is put together as described in RFC 3986.
      Parameter:
      keys - A GList containing the query argument key strings.
      Gibt zurück:
      The string version of the URI.
    • construct

      @Deprecated public static Str construct(@Nonnull Str protocol, @Nonnull Str location)
      Veraltet.
      Constructs a URI for a given valid protocol and location.

      Free-function: g_free
      Parameter:
      protocol - Protocol for URI
      location - Location for URI
      Gibt zurück:
      a new string for this URI.
    • fromString

      public static Uri fromString(@Nonnull Str uri)
      Parses a URI string into a new #GstUri object. Will return NULL if the URI
      cannot be parsed.
      Parameter:
      uri - The URI string to parse.
      Gibt zurück:
      A new #GstUri object, or NULL.
    • fromStringEscaped

      public static Uri fromStringEscaped(@Nonnull Str uri)
      Parses a URI string into a new #GstUri object. Will return NULL if the URI
      cannot be parsed. This is identical to gst_uri_from_string() except that
      the userinfo and fragment components of the URI will not be unescaped while
      parsing.

      Use this when you need to extract a username and password from the userinfo
      such as https://user:password@example.com since either may contain
      a URI-escaped ':' character. gst_uri_from_string() will unescape the entire
      userinfo component, which will make it impossible to know which ':'
      delineates the username and password.

      The same applies to the fragment component of the URI, such as
      https://example.com/path#fragment which may contain a URI-escaped '#'.
      Parameter:
      uri - The URI string to parse.
      Gibt zurück:
      A new #GstUri object, or NULL.
    • getLocation

      public static Str getLocation(@Nonnull Str uri)
      Extracts the location out of a given valid URI, ie. the protocol and "://"
      are stripped from the URI, which means that the location returned includes
      the hostname if one is specified. The returned string must be freed using
      g_free().

      Free-function: g_free
      Parameter:
      uri - A URI string
      Gibt zurück:
      the location for this URI. Returns %NULL if the URI isn't valid. If the URI does not contain a location, an empty string is returned.
    • getProtocol

      public static Str getProtocol(@Nonnull Str uri)
      Extracts the protocol out of a given valid URI. The returned string must be
      freed using g_free().
      Parameter:
      uri - A URI string
      Gibt zurück:
      The protocol for this URI.
    • hasProtocol

      public static boolean hasProtocol(@Nonnull Str uri, @Nonnull Str protocol)
      Checks if the protocol of a given valid URI matches @protocol.
      Parameter:
      uri - a URI string
      protocol - a protocol string (e.g. "http")
      Gibt zurück:
      %TRUE if the protocol matches.
    • isValid

      public static boolean isValid(@Nonnull Str uri)
      Tests if the given string is a valid URI identifier. URIs start with a valid
      scheme followed by ":" and maybe a string identifying the location.
      Parameter:
      uri - A URI string
      Gibt zurück:
      %TRUE if the string is a valid URI
    • joinStrings

      public static Str joinStrings(@Nonnull Str base_uri, @Nonnull Str ref_uri)
      This is a convenience function to join two URI strings and return the result.
      The returned string should be g_free()'d after use.
      Parameter:
      base_uri - The percent-encoded base URI.
      ref_uri - The percent-encoded reference URI to join to the @base_uri.
      Gibt zurück:
      A string representing the percent-encoded join of the two URIs.
    • protocolIsSupported

      public static boolean protocolIsSupported(int type, @Nonnull Str protocol)
      Checks if an element exists that supports the given URI protocol. Note
      that a positive return value does not imply that a subsequent call to
      gst_element_make_from_uri() is guaranteed to work.
      Parameter:
      type - Whether to check for a source or a sink
      protocol - Protocol that should be checked for (e.g. "http" or "smb")
      Gibt zurück:
      %TRUE
    • protocolIsValid

      public static boolean protocolIsValid(@Nonnull Str protocol)
      Tests if the given string is a valid protocol identifier. Protocols
      must consist of alphanumeric characters, '+', '-' and '.' and must
      start with a alphabetic character. See RFC 3986 Section 3.1.
      Parameter:
      protocol - A string
      Gibt zurück:
      %TRUE if the string is a valid protocol identifier, %FALSE otherwise.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()