Package org.bitcoinj.core
Class EmptyMessage
- java.lang.Object
-
- org.bitcoinj.core.Message
-
- org.bitcoinj.core.EmptyMessage
-
- Direct Known Subclasses:
GetAddrMessage,SendAddrV2Message,SendHeadersMessage,UnknownMessage,VersionAck
public abstract class EmptyMessage extends Message
Parent class for header only messages that don't have a payload. Currently this includes getaddr, verack and special bitcoinj class UnknownMessage.
Instances of this class are not safe for use by multiple threads.
-
-
Field Summary
-
Fields inherited from class org.bitcoinj.core.Message
MAX_SIZE, params, payload, serializer
-
-
Constructor Summary
Constructors Constructor Description EmptyMessage()EmptyMessage(NetworkParameters params)EmptyMessage(NetworkParameters params, java.nio.ByteBuffer payload)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbitcoinSerializeToStream(java.io.OutputStream stream)Serializes this message to the provided stream.intgetMessageSize()Return the size of the serialized message.protected voidparse()-
Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, getHash, getParams, readByte, readByteArray, readBytes, readHash, readInt32, readInt64, readStr, readUint32, readUint64, readVarInt, skipBytes, unCache, unsafeBitcoinSerialize
-
-
-
-
Constructor Detail
-
EmptyMessage
public EmptyMessage()
-
EmptyMessage
public EmptyMessage(NetworkParameters params)
-
EmptyMessage
public EmptyMessage(NetworkParameters params, java.nio.ByteBuffer payload) throws ProtocolException
- Throws:
ProtocolException
-
-
Method Detail
-
getMessageSize
public final int getMessageSize()
Description copied from class:MessageReturn the size of the serialized message. Note that if the message was deserialized from a payload, this size can differ from the size of the original payload.- Overrides:
getMessageSizein classMessage- Returns:
- size of the serialized message in bytes
-
bitcoinSerializeToStream
protected final void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from class:MessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStreamin classMessage- Throws:
java.io.IOException
-
parse
protected void parse() throws java.nio.BufferUnderflowException, ProtocolException- Specified by:
parsein classMessage- Throws:
java.nio.BufferUnderflowExceptionProtocolException
-
-