Class Socket.Builder<B extends Socket.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
Socket

public static class Socket.Builder<B extends Socket.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
2.22
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public Socket build()
      Finish building the Socket object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to Socket.
      Overrides:
      build in class GObject.Builder<B extends Socket.Builder<B>>
      Returns:
      a new instance of Socket with the properties that were set in the Builder object.
    • setBlocking

      public B setBlocking(boolean blocking)
      Whether I/O on this socket is blocking.
      Parameters:
      blocking - the value for the blocking property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setBroadcast

      public B setBroadcast(boolean broadcast)
      Whether the socket should allow sending to broadcast addresses.
      Parameters:
      broadcast - the value for the broadcast property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.32
    • setFamily

      public B setFamily(SocketFamily family)
      The socket’s address family.
      Parameters:
      family - the value for the family property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setFd

      public B setFd(int fd)
      The socket’s file descriptor.
      Parameters:
      fd - the value for the fd property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setKeepalive

      public B setKeepalive(boolean keepalive)
      Whether to keep the connection alive by sending periodic pings.
      Parameters:
      keepalive - the value for the keepalive property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setListenBacklog

      public B setListenBacklog(int listenBacklog)
      The number of outstanding connections in the listen queue.
      Parameters:
      listenBacklog - the value for the listen-backlog property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setMulticastLoopback

      public B setMulticastLoopback(boolean multicastLoopback)
      Whether outgoing multicast packets loop back to the local host.
      Parameters:
      multicastLoopback - the value for the multicast-loopback property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.32
    • setMulticastTtl

      public B setMulticastTtl(int multicastTtl)
      Time-to-live out outgoing multicast packets
      Parameters:
      multicastTtl - the value for the multicast-ttl property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.32
    • setProtocol

      public B setProtocol(SocketProtocol protocol)
      The ID of the protocol to use, or -1 for unknown.
      Parameters:
      protocol - the value for the protocol property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • setTimeout

      public B setTimeout(int timeout)
      The timeout in seconds on socket I/O
      Parameters:
      timeout - the value for the timeout property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setTtl

      public B setTtl(int ttl)
      Time-to-live for outgoing unicast packets
      Parameters:
      ttl - the value for the ttl property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.32
    • setType

      public B setType(SocketType type)
      The socket’s type.
      Parameters:
      type - the value for the type property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22