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
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidbitcoinSerializeToStream(OutputStream stream) Serializes this message to the provided stream.static HeadersMessageread(ByteBuffer payload) Deserialize this message from a given payload.Methods inherited from class org.bitcoinj.core.BaseMessage
messageSize, serializeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:BaseMessageSerializes this message to the provided stream. If you just want the raw bytes useBaseMessage.serialize().- Specified by:
 bitcoinSerializeToStreamin classBaseMessage- Throws:
 IOException
 - 
getBlockHeaders
 
 -