public final class BuilderUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
closeAndRethrowUnchecked(java.io.Closeable closable)
Call
Closeable.close() and re-throw an unchecked exception if a checked exception is thrown. |
static java.lang.Class<? extends io.netty.channel.socket.DatagramChannel> |
datagramChannel(io.netty.channel.EventLoopGroup group)
Returns the correct
Class to use with the given EventLoopGroup . |
static java.lang.String |
formatCanonicalAddress(java.net.SocketAddress address)
Format an address into a canonical numeric format.
|
static java.lang.Class<? extends io.netty.channel.ServerChannel> |
serverChannel(io.netty.channel.EventLoopGroup group,
java.lang.Class<? extends java.net.SocketAddress> addressClass)
Returns the correct
Class to use with the given EventLoopGroup . |
static java.lang.Class<? extends io.netty.channel.Channel> |
socketChannel(io.netty.channel.EventLoopGroup group,
java.lang.Class<? extends java.net.SocketAddress> addressClass)
Returns the correct
Class to use with the given EventLoopGroup . |
static io.netty.channel.Channel |
socketChannel(io.netty.channel.EventLoopGroup group,
FileDescriptorSocketAddress address)
Returns the correct Channel that wraps the given filedescriptor or
null if not supported. |
static java.net.SocketAddress |
toNettyAddress(java.lang.Object address)
If
address if a ServiceTalk specific address it is unwrapped into a Netty address. |
static boolean |
useEpoll(io.netty.channel.EventLoopGroup group)
Returns
true if native epoll transport should be used. |
static boolean |
useKQueue(io.netty.channel.EventLoopGroup group)
Returns
true if native kqueue transport should be used. |
public static boolean useEpoll(io.netty.channel.EventLoopGroup group)
true
if native epoll transport should be used.group
- the used EventLoopGroup
true
if native transport should be usedpublic static boolean useKQueue(io.netty.channel.EventLoopGroup group)
true
if native kqueue transport should be used.group
- the used EventLoopGroup
true
if native transport should be usedpublic static java.lang.Class<? extends io.netty.channel.ServerChannel> serverChannel(io.netty.channel.EventLoopGroup group, java.lang.Class<? extends java.net.SocketAddress> addressClass)
Class
to use with the given EventLoopGroup
.group
- the EventLoopGroup
for which the class is neededaddressClass
- The class of the address that the server socket will be bound to.public static java.lang.Class<? extends io.netty.channel.Channel> socketChannel(io.netty.channel.EventLoopGroup group, java.lang.Class<? extends java.net.SocketAddress> addressClass)
Class
to use with the given EventLoopGroup
.group
- the EventLoopGroup
for which the class is neededaddressClass
- The class of the address that to connect to.@Nullable public static io.netty.channel.Channel socketChannel(io.netty.channel.EventLoopGroup group, FileDescriptorSocketAddress address)
null
if not supported.group
- the EventLoopGroup
for which the class is neededaddress
- the filedescriptor to wrap.public static java.net.SocketAddress toNettyAddress(java.lang.Object address)
address
if a ServiceTalk specific address it is unwrapped into a Netty address.address
- the address to convert.public static java.lang.Class<? extends io.netty.channel.socket.DatagramChannel> datagramChannel(io.netty.channel.EventLoopGroup group)
Class
to use with the given EventLoopGroup
.group
- the EventLoopGroup
for which the class is neededpublic static java.lang.String formatCanonicalAddress(java.net.SocketAddress address)
address
- socket addresspublic static void closeAndRethrowUnchecked(@Nullable java.io.Closeable closable)
Closeable.close()
and re-throw an unchecked exception if a checked exception is thrown.closable
- The object to close.