Class IConv

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class IConv extends ProxyInstance
The GIConv struct wraps an iconv() conversion descriptor. It contains private data and should only be accessed using the following functions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a IConv proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Same as the standard UNIX routine iconv_close(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.
    The memory layout of the native struct.
    long
    iconv(String[] inbuf, Out<Long> inbytesLeft, String[] outbuf, Out<Long> outbytesLeft)
    Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.
    static @Nullable IConv
    open(String toCodeset, String fromCodeset)
    Same as the standard UNIX routine iconv_open(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

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

    • IConv

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

    • getMemoryLayout

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

      public static @Nullable IConv open(String toCodeset, String fromCodeset)

      Same as the standard UNIX routine iconv_open(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.

      GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient than the raw iconv wrappers.

      Parameters:
      toCodeset - destination codeset
      fromCodeset - source codeset
      Returns:
      a "conversion descriptor", or (GIConv)-1 if opening the converter failed.
    • iconv

      public long iconv(String[] inbuf, Out<Long> inbytesLeft, String[] outbuf, Out<Long> outbytesLeft)

      Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.

      GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient than the raw iconv wrappers.

      Note that the behaviour of iconv() for characters which are valid in the input character set, but which have no representation in the output character set, is implementation defined. This function may return success (with a positive number of non-reversible conversions as replacement characters were used), or it may return -1 and set an error such as EILSEQ, in such a situation.

      See iconv(3posix) and iconv(3) for more details about behavior when an error occurs.

      Parameters:
      inbuf - bytes to convert
      inbytesLeft - inout parameter, bytes remaining to convert in inbuf
      outbuf - converted output bytes
      outbytesLeft - inout parameter, bytes available to fill in outbuf
      Returns:
      count of non-reversible conversions, or -1 on error
    • close

      public int close()

      Same as the standard UNIX routine iconv_close(), but may be implemented via libiconv on UNIX flavors that lack a native implementation. Should be called to clean up the conversion descriptor from g_iconv_open() when you are done converting things.

      GLib provides g_convert() and g_locale_to_utf8() which are likely more convenient than the raw iconv wrappers.

      Returns:
      -1 on error, 0 on success