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
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
ConstructorDescriptionEmptyMessage
(NetworkParameters params) EmptyMessage
(NetworkParameters params, byte[] payload, int offset) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns a copy of the array returned byMessage.unsafeBitcoinSerialize()
, which is safe to mutate.protected final void
bitcoinSerializeToStream
(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 Details
-
EmptyMessage
public EmptyMessage() -
EmptyMessage
-
EmptyMessage
- Throws:
ProtocolException
-
-
Method Details
-
bitcoinSerializeToStream
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:
IOException
-
parse
- 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
-