public class PeerSocketAddress extends Object implements Serializable
| Constructor and Description |
|---|
PeerSocketAddress(InetAddress inetAddress,
int tcpPort,
int udpPort)
Creates a PeerSocketAddress including both UDP and TCP ports.
|
PeerSocketAddress(InetAddress inetAddress,
int tcpPort,
int udpPort,
int offset)
Creates a PeerSocketAddress including both UDP and TCP ports.
|
| Modifier and Type | Method and Description |
|---|---|
static PeerSocketAddress |
create(byte[] me,
boolean isIPv4,
int offsetOriginal)
Converts a byte array into a PeerSocketAddress.
|
static PeerSocketAddress |
create(io.netty.buffer.ByteBuf buf,
boolean isIPv4)
Decodes a PeerSocketAddress from a Netty buffer.
|
static InetSocketAddress |
createSocketTCP(PeerSocketAddress peerSocketAddress)
Creates the socket address to reach this peer with TCP.
|
static InetSocketAddress |
createSocketUDP(PeerSocketAddress peerSocketAddress)
Creates the socket address to reach this peer with UDP.
|
boolean |
equals(Object obj) |
int |
hashCode() |
InetAddress |
inetAddress() |
boolean |
isIPv4() |
int |
offset() |
int |
size()
Calculates the size of this PeerSocketAddress in bytes.
|
static int |
size(boolean isIPv4)
Calculates the size of a PeerSocketAddress in bytes.
|
int |
tcpPort() |
byte[] |
toByteArray()
Serializes the PeerSocketAddress to a byte array.
|
int |
toByteArray(byte[] me,
int offset)
Serializes the PeerSocketAddress to a byte array.
|
String |
toString() |
int |
udpPort() |
public PeerSocketAddress(InetAddress inetAddress, int tcpPort, int udpPort)
inetAddress - The InetAddress of the peer. Can be IPv4 or IPv6tcpPort - The TCP portudpPort - The UDP portpublic PeerSocketAddress(InetAddress inetAddress, int tcpPort, int udpPort, int offset)
inetAddress - The InetAddress of the peer. Can be IPv4 or IPv6tcpPort - The TCP portudpPort - The UDP portoffset - The offset that we processedpublic static PeerSocketAddress create(byte[] me, boolean isIPv4, int offsetOriginal)
me - The byte arrayisIPv4 - Whether its IPv4 or IPv6offsetOriginal - The offset from where to start reading in the arraypublic static PeerSocketAddress create(io.netty.buffer.ByteBuf buf, boolean isIPv4)
buf - The Netty bufferisIPv4 - Whether the address is IPv4 or IPv6public static InetSocketAddress createSocketTCP(PeerSocketAddress peerSocketAddress)
peerSocketAddress - The peer's PeerSocketAddresspublic static InetSocketAddress createSocketUDP(PeerSocketAddress peerSocketAddress)
peerSocketAddress - The peer's PeerSocketAddresspublic InetAddress inetAddress()
public int tcpPort()
public int udpPort()
public int offset()
public byte[] toByteArray()
public int toByteArray(byte[] me,
int offset)
me - The byte array to serialize tooffset - The offset from where to startpublic int size()
public static int size(boolean isIPv4)
isIPv4 - Whether the address is IPv4 or IPv6.public boolean isIPv4()
Copyright © 2014. All rights reserved.