Class SocketAddressEnumerator
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ProxyAddressEnumerator,SocketAddressEnumerator.SocketAddressEnumerator$Impl
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
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static classThe SocketAddressEnumerator$Impl type represents a native instance of the abstract SocketAddressEnumerator class.static classClass structure forGSocketAddressEnumerator.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SocketAddressEnumerator.SocketAddressEnumerator(MemorySegment address) Create a SocketAddressEnumerator proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SocketAddressEnumeratorasParent()Returns this instance as if it were its parent type.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the SocketAddressEnumerator class@Nullable SocketAddressnext(@Nullable Cancellable cancellable) Retrieves the nextGSocketAddressfromenumerator.Note that this may block for some amount of time.voidnextAsync(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously retrieves the nextGSocketAddressfrom this SocketAddressEnumerator and then callscallback,which must call g_socket_address_enumerator_next_finish() to get the result.@Nullable SocketAddressnextFinish(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, builder, 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
SocketAddressEnumerator
public SocketAddressEnumerator()Creates a new SocketAddressEnumerator.
-
-
Method Details
-
getType
Get the GType of the SocketAddressEnumerator class- Returns:
- the GType
-
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 Javasuperkeyword, 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 nextGSocketAddressfromenumerator.Note that this may block for some amount of time. (Eg, aGNetworkAddressmay 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 thancancellablebeing triggered) will be ignored.- Parameters:
cancellable- optionalGCancellableobject,nullto ignore.- Returns:
- a
GSocketAddress(owned by the caller), ornullon error (in which case*errorwill be set) or if there are no more addresses. - Throws:
GErrorException- seeGError
-
nextAsync
Asynchronously retrieves the nextGSocketAddressfrom 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- optionalGCancellableobject,nullto ignore.callback- aGAsyncReadyCallbackto 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), ornullon error (in which case*errorwill be set) or if there are no more addresses. - Throws:
GErrorException- seeGError
-