Package org.gnome.glib
Class IConv
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.glib.IConv
- All Implemented Interfaces:
Proxy
The GIConv struct wraps an iconv() conversion descriptor. It contains
private data and should only be accessed using the following functions.
-
Constructor Summary
ConstructorDescriptionIConv
(MemorySegment address) Create a IConv proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionint
close()
Same as the standard UNIX routine iconv_close(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.long
Same as the standard UNIX routine iconv(), but may be implemented via libiconv on UNIX flavors that lack a native implementation.static IConv
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 io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
IConv
Create a IConv proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
open
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 codesetfromCodeset
- source codeset- Returns:
- a "conversion descriptor", or (GIConv)-1 if opening the converter failed.
-
iconv
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.- Parameters:
inbuf
- bytes to convertinbytesLeft
- inout parameter, bytes remaining to convert ininbuf
outbuf
- converted output bytesoutbytesLeft
- inout parameter, bytes available to fill inoutbuf
- 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
-