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
public class AddressV1Message extends AddressMessage
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 thePeerDiscovery
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAddress(PeerAddress address)
protected void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.static AddressV1Message
read(java.nio.ByteBuffer payload)
Deserialize this message from a given payload.java.lang.String
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 Detail
-
read
public static AddressV1Message read(java.nio.ByteBuffer payload) throws java.nio.BufferUnderflowException, ProtocolException
Deserialize this message from a given payload.- Parameters:
payload
- payload to deserialize from- Returns:
- read message
- Throws:
java.nio.BufferUnderflowException
- if the read message extends beyond the remaining bytes of the payloadProtocolException
-
addAddress
public void addAddress(PeerAddress address)
- Specified by:
addAddress
in classAddressMessage
-
bitcoinSerializeToStream
protected void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
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:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-