public class NetworkUtil
extends java.lang.Object
Constructor and Description |
---|
NetworkUtil() |
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer |
allocateDirectAlignedAndPadded(int capacity,
int alignment)
Allocate a direct
ByteBuffer that is padded at the end with at least alignment bytes. |
static java.net.NetworkInterface[] |
filterBySubnet(java.net.InetAddress address,
int subnetPrefix)
Search for a list of network interfaces that match the specified address and subnet prefix.
|
static java.net.InetAddress |
findAddressOnInterface(java.net.NetworkInterface networkInterface,
java.net.InetAddress address,
int subnetPrefix) |
static java.net.ProtocolFamily |
getProtocolFamily(java.net.InetAddress address) |
public static java.net.NetworkInterface[] filterBySubnet(java.net.InetAddress address, int subnetPrefix) throws java.net.SocketException
InterfaceAddress.getNetworkPrefixLength()
). If no results match, then the collection
will be empty.address
- to search for on the NetworkInterface
s.subnetPrefix
- to limit the search.NetworkInterface
s that match the supplied criteria, ordered by the length
of the subnet prefix. Empty if none match.java.net.SocketException
- if an error occurspublic static java.net.InetAddress findAddressOnInterface(java.net.NetworkInterface networkInterface, java.net.InetAddress address, int subnetPrefix)
public static java.net.ProtocolFamily getProtocolFamily(java.net.InetAddress address)
public static java.nio.ByteBuffer allocateDirectAlignedAndPadded(int capacity, int alignment)
ByteBuffer
that is padded at the end with at least alignment bytes.capacity
- for the buffer.alignment
- for the buffer.ByteBuffer
.Copyright © 2014-2018 Real Logic Ltd. All Rights Reserved.