Class IdStr

java.lang.Object
org.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.IdStr
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class IdStr extends ProxyInstance

A GstIdStr is string type optimized for short strings and used for structure names, structure field names and in other places.

Strings up to 16 bytes (including NUL terminator) are stored inline, other strings are stored on the heap.

GstIdStr s = GST_ID_STR_INIT;

gst_id_str_set (&s, "Hello, World!");
g_print ("%s\\n", gst_id_str_as_str (&s));

gst_id_str_clear (&s);
Since:
1.26
  • Constructor Summary

    Constructors
    Constructor
    Description
    Returns a newly heap allocated empty string.
    Create a IdStr proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    Clears this IdStr and sets it to the empty string.
    Copies this IdStr into newly allocated heap memory.
    void
    Copies s into d.
    void
    Frees s. This should only be called for heap-allocated GstIdStr.
    long
    Returns the length of s, exluding the NUL-terminator.
    The memory layout of the native struct.
    static @Nullable Type
    Get the GType of the IdStr class.
    void
    Initializes a (usually stack-allocated) id string s. The newly-initialized id string will contain an empty string by default as value.
    boolean
    Compares this IdStr and s2 for equality.
    boolean
    Compares this IdStr and s2 for equality.
    boolean
    isEqualToStrWithLen(String s2, long len)
    Compares this IdStr and s2 with length len for equality.
    void
    Moves s into this IdStr and resets s.
    Read the value of the field pointer.
    void
    set(String value)
    Sets this IdStr to the string value.
    void
    Sets this IdStr to the string value. value needs to be valid for the remaining lifetime of the process, e.g.
    void
    setStaticStrWithLen(String value, long len)
    Sets this IdStr to the string value of length len. value needs to be valid for the remaining lifetime of the process, e.g.
    void
    setWithLen(String value, long len)
    Sets this IdStr to the string value of length len. value does not have to be NUL-terminated and len should not include the NUL-terminator.
    void
    Write a value in the field pointer.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IdStr

      public IdStr(MemorySegment address)
      Create a IdStr proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • IdStr

      public IdStr()
      Returns a newly heap allocated empty string.
      Since:
      1.26
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the IdStr class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readPointer

      public MemorySegment readPointer()
      Read the value of the field pointer.
      Returns:
      The value of the field pointer
    • writePointer

      public void writePointer(MemorySegment pointer)
      Write a value in the field pointer.
      Parameters:
      pointer - The new value for the field pointer
    • asStr

      public String asStr()
    • clear

      public void clear()
      Clears this IdStr and sets it to the empty string.
      Since:
      1.26
    • copy

      public IdStr copy()
      Copies this IdStr into newly allocated heap memory.
      Returns:
      A heap-allocated copy of s.
      Since:
      1.26
    • copyInto

      public void copyInto(IdStr s)
      Copies s into d.
      Parameters:
      s - The source GstIdStr
      Since:
      1.26
    • free

      public void free()
      Frees s. This should only be called for heap-allocated GstIdStr.
      Since:
      1.26
    • getLen

      public long getLen()
      Returns the length of s, exluding the NUL-terminator. This is equivalent to calling strcmp() but potentially faster.
      Since:
      1.26
    • init

      public void init()
      Initializes a (usually stack-allocated) id string s. The newly-initialized id string will contain an empty string by default as value.
      Since:
      1.26
    • isEqual

      public boolean isEqual(IdStr s2)
      Compares this IdStr and s2 for equality.
      Parameters:
      s2 - A GstIdStr
      Returns:
      true if this IdStr and s2 are equal.
      Since:
      1.26
    • isEqualToStr

      public boolean isEqualToStr(String s2)
      Compares this IdStr and s2 for equality.
      Parameters:
      s2 - A string
      Returns:
      true if this IdStr and s2 are equal.
      Since:
      1.26
    • isEqualToStrWithLen

      public boolean isEqualToStrWithLen(String s2, long len)

      Compares this IdStr and s2 with length len for equality. s2 does not have to be NUL-terminated and len should not include the NUL-terminator.

      This is generally faster than gst_id_str_is_equal_to_str() if the length is already known.

      Parameters:
      s2 - A string
      len - Length of s2.
      Returns:
      true if this IdStr and s2 are equal.
      Since:
      1.26
    • move

      public void move(IdStr s)
      Moves s into this IdStr and resets s.
      Parameters:
      s - The source GstIdStr
      Since:
      1.26
    • set

      public void set(String value)
      Sets this IdStr to the string value.
      Parameters:
      value - A NUL-terminated string
      Since:
      1.26
    • setStaticStr

      public void setStaticStr(String value)
      Sets this IdStr to the string value. value needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.
      Parameters:
      value - A NUL-terminated string
      Since:
      1.26
    • setStaticStrWithLen

      public void setStaticStrWithLen(String value, long len)

      Sets this IdStr to the string value of length len. value needs to be valid for the remaining lifetime of the process, e.g. has to be a static string.

      value must be NUL-terminated and len should not include the NUL-terminator.

      Parameters:
      value - A string
      len - Length of the string
      Since:
      1.26
    • setWithLen

      public void setWithLen(String value, long len)
      Sets this IdStr to the string value of length len. value does not have to be NUL-terminated and len should not include the NUL-terminator.
      Parameters:
      value - A string
      len - Length of the string
      Since:
      1.26