com.google.bitcoin.core
Class AddressMessage
java.lang.Object
com.google.bitcoin.core.Message
com.google.bitcoin.core.AddressMessage
- All Implemented Interfaces:
- Serializable
public class AddressMessage
- extends Message
Represents an "addr" message on the P2P network, which contains broadcast IP addresses of other peers. This is
one of the ways peers can find each other without using the DNS or IRC discovery mechansisms. However storing and
using addr messages is not presently implemented.
- See Also:
- Serialized Form
| Fields inherited from class com.google.bitcoin.core.Message |
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH |
| Methods inherited from class com.google.bitcoin.core.Message |
adjustLength, bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getParams, isCached, isParsed, isRecached, maybeParse, unCache, unsafeBitcoinSerialize |
parseLite
protected void parseLite()
throws ProtocolException
- Description copied from class:
Message
- Perform the most minimal parse possible to calculate the length of the message.
This is only required for subclasses of ChildClass as root level messages will have their length passed
into the constructor.
Implementations should adhere to the following contract: If parseLazy = true the 'length'
field must be set before returning. If parseLazy = false the length field must be set either
within the parseLite() method OR the parse() method. The overriding requirement is that length
must be set to non UNKNOWN_MESSAGE value by the time the constructor exits.
- Specified by:
parseLite in class Message
- Throws:
ProtocolException
getMessageSize
public int getMessageSize()
- Description copied from class:
Message
- This should be overridden to extract correct message size in the case of lazy parsing. Until this method is
implemented in a subclass of ChildMessage lazy parsing may have no effect.
This default implementation is a safe fall back that will ensure it returns a correct value by parsing the message.
- Overrides:
getMessageSize in class Message
getAddresses
public List<PeerAddress> getAddresses()
- Returns:
- An unmodifiableList view of the backing List of addresses. Addresses contained within the list may be safely modified.
addAddress
public void addAddress(PeerAddress address)
removeAddress
public void removeAddress(int index)
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2014. All rights reserved.