Class 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 the PeerDiscovery mechanism.
    • 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.