public class PeerSocketAddress extends Object implements Serializable
| Constructor and Description |
|---|
PeerSocketAddress(InetAddress inetAddress,
int tcpPort,
int udpPort)
Creates a new PeerSocketAddress including both UDP and TCP ports.
|
PeerSocketAddress(InetAddress inetAddress,
int tcpPort,
int udpPort,
int offset)
Creates a new PeerSocketAddress including both UDP and TCP ports.
|
| Modifier and Type | Method and Description |
|---|---|
static PeerSocketAddress |
create(byte[] me,
boolean isIPv4,
int offsetOriginal)
Converts an byte array into a peer socket address.
|
static PeerSocketAddress |
create(io.netty.buffer.ByteBuf ch,
boolean isIPv4)
Converts an ChannelBuffer into a peer socket address.
|
static InetSocketAddress |
createSocketTCP(PeerSocketAddress peerSocketAddress)
Returns the socket address.
|
static InetSocketAddress |
createSocketUDP(PeerSocketAddress peerSocketAddress)
Returns the socket address.
|
boolean |
equals(Object obj) |
int |
hashCode() |
InetAddress |
inetAddress() |
boolean |
isIPv4() |
int |
offset() |
int |
size() |
static int |
size(boolean isIPv4) |
int |
tcpPort() |
byte[] |
toByteArray() |
int |
toByteArray(byte[] me,
int offset)
Serializes a peer socket address to a byte array.
|
String |
toString() |
int |
udpPort() |
public PeerSocketAddress(InetAddress inetAddress, int tcpPort, int udpPort)
inetAddress - The InetAddress of the peer. Can be IPv6 or IPv4tcpPort - The TCP portudpPort - The UDP portpublic PeerSocketAddress(InetAddress inetAddress, int tcpPort, int udpPort, int offset)
inetAddress - The InetAddress of the peer. Can be IPv6 or IPv4tcpPort - The TCP portudpPort - The UDP portoffset - The offset that we processedpublic InetAddress inetAddress()
public int tcpPort()
public int udpPort()
public int offset()
public byte[] toByteArray()
public int size()
public static int size(boolean isIPv4)
public int toByteArray(byte[] me,
int offset)
me - The byte array to store the serializationoffset - The offset where to startpublic boolean isIPv4()
public static PeerSocketAddress create(byte[] me, boolean isIPv4, int offsetOriginal)
me - The byte arrayisIPv4 - Indicates if its IPv4 or IPv6offsetOriginal - The offset where to start reading in the arraypublic static PeerSocketAddress create(io.netty.buffer.ByteBuf ch, boolean isIPv4)
ch - The channel bufferisIPv4 - if the IP is v4 or v6public static InetSocketAddress createSocketTCP(PeerSocketAddress peerSocketAddress)
public static InetSocketAddress createSocketUDP(PeerSocketAddress peerSocketAddress)
Copyright © 2014. All rights reserved.