Package org.bitcoinj.core
Class AddressV2Message
java.lang.Object
org.bitcoinj.core.BaseMessage
org.bitcoinj.core.AddressMessage
org.bitcoinj.core.AddressV2Message
- All Implemented Interfaces:
Message
Represents an "addrv2" message on the P2P network, which contains broadcast addresses of other peers. This is
one of the ways peers can find each other without using the
PeerDiscovery mechanism.
See BIP155 for details.
Instances of this class are not safe for use by multiple threads.
-
Field Summary
Fields inherited from class org.bitcoinj.core.AddressMessage
addresses, MAX_ADDRESSES -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddress(PeerAddress address) protected voidbitcoinSerializeToStream(OutputStream stream) Serializes this message to the provided stream.static AddressV2Messageread(ByteBuffer payload) Deserialize this message from a given payload.toString()Methods inherited from class org.bitcoinj.core.AddressMessage
getAddresses, readAddresses, removeAddressMethods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serializeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
Method Details
-
read
public static AddressV2Message read(ByteBuffer payload) throws BufferUnderflowException, ProtocolException Deserialize this message from a given payload.- Parameters:
payload- payload to deserialize from- Returns:
- read message
- Throws:
BufferUnderflowException- if the read message extends beyond the remaining bytes of the payloadProtocolException
-
addAddress
- Specified by:
addAddressin classAddressMessage
-
bitcoinSerializeToStream
Description copied from class:BaseMessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Specified by:
bitcoinSerializeToStreamin classBaseMessage- Throws:
IOException
-
toString
-