Class SocketAddressEnumerator
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ProxyAddressEnumerator
,SocketAddressEnumerator.SocketAddressEnumeratorImpl
GSocketAddressEnumerator
is an enumerator type for
SocketAddress
instances. It is returned by enumeration functions
such as SocketConnectable.enumerate()
, which returns a
GSocketAddressEnumerator
to list each SocketAddress
which could
be used to connect to that SocketConnectable
.
Enumeration is typically a blocking operation, so the asynchronous methods
nextAsync(org.gnome.gio.Cancellable, org.gnome.gio.AsyncReadyCallback)
and
nextFinish(org.gnome.gio.AsyncResult)
should be used where
possible.
Each GSocketAddressEnumerator
can only be enumerated once. Once
next(org.gnome.gio.Cancellable)
has returned NULL
, further
enumeration with that GSocketAddressEnumerator
is not possible, and it can
be unreffed.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Inner class implementing a builder pattern to construct a GObject with properties.static class
Class structure forGSocketAddressEnumerator
.static class
The SocketAddressEnumeratorImpl type represents a native instance of the abstract SocketAddressEnumerator class.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionSocketAddressEnumerator
(MemorySegment address) Create a SocketAddressEnumerator proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SocketAddressEnumerator
asParent()
Returns this instance as if it were its parent type.static SocketAddressEnumerator.Builder
<? extends SocketAddressEnumerator.Builder> builder()
ASocketAddressEnumerator.Builder
object constructs aSocketAddressEnumerator
with the specified properties.static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the SocketAddressEnumerator classnext
(@Nullable Cancellable cancellable) Retrieves the nextGSocketAddress
from this SocketAddressEnumerator.void
nextAsync
(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously retrieves the nextGSocketAddress
from this SocketAddressEnumerator and then callscallback
, which must call g_socket_address_enumerator_next_finish() to get the result.nextFinish
(AsyncResult result) Retrieves the result of a completed call to g_socket_address_enumerator_next_async().Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SocketAddressEnumerator
Create a SocketAddressEnumerator proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
next
Retrieves the nextGSocketAddress
from this SocketAddressEnumerator. Note that this may block for some amount of time. (Eg, aGNetworkAddress
may need to do a DNS lookup before it can return an address.) Use g_socket_address_enumerator_next_async() if you need to avoid blocking.If this SocketAddressEnumerator is expected to yield addresses, but for some reason is unable to (eg, because of a DNS error), then the first call to g_socket_address_enumerator_next() will return an appropriate error in *
error
. However, if the first call to g_socket_address_enumerator_next() succeeds, then any further internal errors (other thancancellable
being triggered) will be ignored.- Parameters:
cancellable
- optionalGCancellable
object,null
to ignore.- Returns:
- a
GSocketAddress
(owned by the caller), ornull
on error (in which case *error
will be set) or if there are no more addresses. - Throws:
GErrorException
- seeGError
-
nextAsync
public void nextAsync(@Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Asynchronously retrieves the nextGSocketAddress
from this SocketAddressEnumerator and then callscallback
, which must call g_socket_address_enumerator_next_finish() to get the result.It is an error to call this multiple times before the previous callback has finished.
- Parameters:
cancellable
- optionalGCancellable
object,null
to ignore.callback
- aGAsyncReadyCallback
to call when the request is satisfied
-
nextFinish
Retrieves the result of a completed call to g_socket_address_enumerator_next_async(). See g_socket_address_enumerator_next() for more information about error handling.- Parameters:
result
- aGAsyncResult
- Returns:
- a
GSocketAddress
(owned by the caller), ornull
on error (in which case *error
will be set) or if there are no more addresses. - Throws:
GErrorException
- seeGError
-
builder
ASocketAddressEnumerator.Builder
object constructs aSocketAddressEnumerator
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSocketAddressEnumerator.Builder.build()
.
-