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
ConstructorsConstructorDescriptionEmptyMessage(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 voidbitcoinSerializeToStream(OutputStream stream) Serializes this message to the provided stream.protected voidparse()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:MessageSerializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().- Overrides:
bitcoinSerializeToStreamin classMessage- Throws:
IOException
-
parse
- Specified by:
parsein classMessage- Throws:
ProtocolException
-
bitcoinSerialize
public byte[] bitcoinSerialize()Description copied from class:MessageReturns 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:
bitcoinSerializein classMessage- Returns:
- a freshly allocated serialized byte array
-