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
cursor, length, MAX_SIZE, offset, params, payload, recached, serializer, UNKNOWN_LENGTH
-
-
Constructor Summary
Constructors Constructor Description EmptyMessage()
EmptyMessage(NetworkParameters params)
EmptyMessage(NetworkParameters params, byte[] payload, int offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
bitcoinSerialize()
Returns a copy of the array returned byMessage.unsafeBitcoinSerialize()
, which is safe to mutate.protected void
bitcoinSerializeToStream(java.io.OutputStream stream)
Serializes this message to the provided stream.protected void
parse()
-
Methods inherited from class org.bitcoinj.core.Message
adjustLength, bitcoinSerialize, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unCache, unsafeBitcoinSerialize
-
-
-
-
Constructor Detail
-
EmptyMessage
public EmptyMessage()
-
EmptyMessage
public EmptyMessage(NetworkParameters params)
-
EmptyMessage
public EmptyMessage(NetworkParameters params, byte[] payload, int offset) throws ProtocolException
- Throws:
ProtocolException
-
-
Method Detail
-
bitcoinSerializeToStream
protected final void bitcoinSerializeToStream(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:Message
Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStream
in classMessage
- Throws:
java.io.IOException
-
parse
protected void parse() throws ProtocolException
- Specified by:
parse
in classMessage
- Throws:
ProtocolException
-
bitcoinSerialize
public byte[] bitcoinSerialize()
Description copied from class:Message
Returns a copy of the array returned byMessage.unsafeBitcoinSerialize()
, which is safe to mutate. If you need extra performance and can guarantee you won't write to the array, you can use the unsafe version.- Overrides:
bitcoinSerialize
in classMessage
- Returns:
- a freshly allocated serialized byte array
-
-