Package org.bitcoinj.core
Class HeadersMessage
java.lang.Object
org.bitcoinj.core.BaseMessage
org.bitcoinj.core.HeadersMessage
- All Implemented Interfaces:
Message
A protocol message that contains a repeated series of block headers, sent in response to the "getheaders" command. This is useful when you want to traverse the chain but know you don't care about the block contents, for example, because you have a freshly created wallet with no keys.
Instances of this class are not safe for use by multiple threads.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
bitcoinSerializeToStream
(OutputStream stream) Serializes this message to the provided stream.static HeadersMessage
read
(ByteBuffer payload) Deserialize this message from a given payload.Methods inherited from class org.bitcoinj.core.BaseMessage
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 Details
-
MAX_HEADERS
public static final int MAX_HEADERS- See Also:
-
-
Constructor Details
-
HeadersMessage
- Throws:
ProtocolException
-
HeadersMessage
- Throws:
ProtocolException
-
-
Method Details
-
read
public static HeadersMessage 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
-
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
-
getBlockHeaders
-