Class Encoding

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gtksourceview.Encoding
All Implemented Interfaces:
Proxy

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

Character encoding.

The GtkSourceEncoding boxed type represents a character encoding. It is used for example by GtkSourceFile. Note that the text in GTK widgets is always encoded in UTF-8.

  • Constructor Details

    • Encoding

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

    • getType

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

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

      public static SList<Encoding> getAll()
      Gets all encodings.
      Returns:
      a list of all GtkSourceEncoding's. Free with g_slist_free().
    • getCurrent

      public static Encoding getCurrent()

      Gets the GtkSourceEncoding for the current locale.

      See also GLib#getCharset.

      Returns:
      the current locale encoding.
    • getDefaultCandidates

      public static SList<Encoding> getDefaultCandidates()

      Gets the list of default candidate encodings to try when loading a file.

      See FileLoader.setCandidateEncodings(SList).

      This function returns a different list depending on the current locale (i.e. language, country and default encoding). The UTF-8 encoding and the current locale encoding are guaranteed to be present in the returned list.

      Returns:
      the list of default candidate encodings. Free with g_slist_free().
    • getFromCharset

      public static @Nullable Encoding getFromCharset(String charset)
      Gets a GtkSourceEncoding from a character set such as "UTF-8" or "ISO-8859-1".
      Parameters:
      charset - a character set.
      Returns:
      the corresponding GtkSourceEncoding, or null if not found.
    • getUtf8

      public static Encoding getUtf8()
    • copy

      public Encoding copy()
      Used by language bindings.
      Returns:
      a copy of enc.
    • free

      public void free()
      Used by language bindings.
    • getCharset

      public String getCharset()
      Gets the character set of the GtkSourceEncoding, such as "UTF-8" or "ISO-8859-1".
      Returns:
      the character set of the GtkSourceEncoding.
    • getName

      public String getName()
      Gets the name of the GtkSourceEncoding such as "Unicode" or "Western".
      Returns:
      the name of the GtkSourceEncoding.
    • toString

      public String toString()
      Overrides:
      toString in class Object