Package org.bitcoinj.core
Class AddressMessage
- java.lang.Object
-
- org.bitcoinj.core.BaseMessage
-
- org.bitcoinj.core.AddressMessage
-
- All Implemented Interfaces:
Message
- Direct Known Subclasses:
AddressV1Message
,AddressV2Message
public abstract class AddressMessage extends BaseMessage
Abstract superclass for address messages on the P2P network, which contain network addresses of other peers. This is one of the ways peers can find each other without using thePeerDiscovery
mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<PeerAddress>
addresses
protected static long
MAX_ADDRESSES
-
Constructor Summary
Constructors Modifier Constructor Description protected
AddressMessage(java.util.List<PeerAddress> addresses)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addAddress(PeerAddress address)
java.util.List<PeerAddress>
getAddresses()
protected static java.util.List<PeerAddress>
readAddresses(java.nio.ByteBuffer payload, int protocolVariant)
void
removeAddress(int index)
-
Methods inherited from class org.bitcoinj.core.BaseMessage
bitcoinSerializeToStream, messageSize, serialize
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
-
-
-
Field Detail
-
MAX_ADDRESSES
protected static final long MAX_ADDRESSES
- See Also:
- Constant Field Values
-
addresses
protected java.util.List<PeerAddress> addresses
-
-
Constructor Detail
-
AddressMessage
protected AddressMessage(java.util.List<PeerAddress> addresses)
-
-
Method Detail
-
readAddresses
protected static java.util.List<PeerAddress> readAddresses(java.nio.ByteBuffer payload, int protocolVariant) throws java.nio.BufferUnderflowException, ProtocolException
- Throws:
java.nio.BufferUnderflowException
ProtocolException
-
addAddress
public abstract void addAddress(PeerAddress address)
-
removeAddress
public void removeAddress(int index)
-
getAddresses
public java.util.List<PeerAddress> getAddresses()
- Returns:
- An unmodifiableList view of the backing List of addresses. Addresses contained within the list may be safely modified.
-
-