Package org.bitcoinj.core
Class AddressV1Message
java.lang.Object
org.bitcoinj.core.BaseMessage
org.bitcoinj.core.AddressMessage
org.bitcoinj.core.AddressV1Message
- All Implemented Interfaces:
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
PeerDiscovery
mechanism.
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 TypeMethodDescriptionvoid
addAddress
(PeerAddress address) protected void
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.static AddressV1Message
read
(ByteBuffer payload) Deserialize this message from a given payload.toString()
Methods inherited from class org.bitcoinj.core.AddressMessage
getAddresses, readAddresses, removeAddress
Methods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serialize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bitcoinj.core.Message
bitcoinSerialize, getMessageSize, unsafeBitcoinSerialize
-
Method Details
-
read
public static AddressV1Message 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:
addAddress
in classAddressMessage
-
bitcoinSerializeToStream
Description copied from class:BaseMessage
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Specified by:
bitcoinSerializeToStream
in classBaseMessage
- Throws:
IOException
-
toString
-