public class PeerAddress extends ChildMessage
Message.LazyParseException
parent
checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, payload, protocolVersion, recached, UNKNOWN_LENGTH
Constructor and Description |
---|
PeerAddress(InetAddress addr)
Constructs a peer address from the given IP address.
|
PeerAddress(InetAddress addr,
int port)
Constructs a peer address from the given IP address and port.
|
PeerAddress(InetAddress addr,
int port,
int protocolVersion)
Construct a peer address from a memorized or hardcoded address.
|
PeerAddress(InetSocketAddress addr) |
PeerAddress(NetworkParameters params,
byte[] payload,
int offset,
int protocolVersion)
Construct a peer address from a serialized payload.
|
PeerAddress(NetworkParameters params,
byte[] payload,
int offset,
int protocolVersion,
Message parent,
boolean parseLazy,
boolean parseRetain)
Construct a peer address from a serialized payload.
|
Modifier and Type | Method and Description |
---|---|
protected void |
bitcoinSerializeToStream(OutputStream stream)
Serializes this message to the provided stream.
|
boolean |
equals(Object o) |
InetAddress |
getAddr() |
int |
getMessageSize()
This should be overridden to extract correct message size in the case of lazy parsing.
|
int |
getPort() |
BigInteger |
getServices() |
long |
getTime() |
int |
hashCode() |
static PeerAddress |
localhost(NetworkParameters params) |
protected void |
parse() |
protected void |
parseLite()
Perform the most minimal parse possible to calculate the length of the message payload.
|
void |
setAddr(InetAddress addr) |
void |
setPort(int port) |
void |
setServices(BigInteger services) |
void |
setTime(long time) |
InetSocketAddress |
toSocketAddress() |
String |
toString() |
adjustLength, adjustLength, setParent, unCache
bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getParams, isCached, isParsed, isRecached, maybeParse, unsafeBitcoinSerialize
public PeerAddress(NetworkParameters params, byte[] payload, int offset, int protocolVersion) throws ProtocolException
ProtocolException
public PeerAddress(NetworkParameters params, byte[] payload, int offset, int protocolVersion, Message parent, boolean parseLazy, boolean parseRetain) throws ProtocolException
params
- NetworkParameters object.payload
- Bitcoin protocol formatted byte array containing message content.offset
- The location of the first payload byte within the array.protocolVersion
- Bitcoin protocol version.parseLazy
- Whether to perform a full parse immediately or delay until a read is requested.parseRetain
- Whether to retain the backing byte array for quick reserialization.
If true and the backing byte array is invalidated due to modification of a field then
the cached bytes may be repopulated and retained if the message is serialized again in the future.ProtocolException
public PeerAddress(InetAddress addr, int port, int protocolVersion)
public PeerAddress(InetAddress addr, int port)
public PeerAddress(InetAddress addr)
public PeerAddress(InetSocketAddress addr)
public static PeerAddress localhost(NetworkParameters params)
protected void bitcoinSerializeToStream(OutputStream stream) throws IOException
Message
IOException
protected void parseLite()
Message
protected void parse() throws ProtocolException
ProtocolException
public int getMessageSize()
Message
getMessageSize
in class Message
public InetAddress getAddr()
public void setAddr(InetAddress addr)
addr
- the addr to setpublic int getPort()
public void setPort(int port)
port
- the port to setpublic BigInteger getServices()
public void setServices(BigInteger services)
services
- the services to setpublic long getTime()
public void setTime(long time)
time
- the time to setpublic InetSocketAddress toSocketAddress()
Copyright © 2014. All rights reserved.