Package org.bitcoinj.core
Class ChildMessage
java.lang.Object
org.bitcoinj.core.Message
org.bitcoinj.core.ChildMessage
- Direct Known Subclasses:
PeerAddress
,Transaction
,TransactionInput
,TransactionOutPoint
,TransactionOutput
Represents a Message type that can be contained within another Message. ChildMessages that have a cached backing byte array need to invalidate their parent's caches as well as their own if they are modified.
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
ModifierConstructorDescriptionprotected
Deprecated.ChildMessage
(NetworkParameters params) ChildMessage
(NetworkParameters params, byte[] payload, int offset) ChildMessage
(NetworkParameters params, byte[] payload, int offset, Message parent, MessageSerializer serializer, int length) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
adjustLength
(int adjustment) protected void
adjustLength
(int newArraySize, int adjustment) final void
protected void
unCache()
To be called before any change of internal values including any setters.Methods inherited from class org.bitcoinj.core.Message
bitcoinSerialize, bitcoinSerialize, bitcoinSerializeToStream, getHash, getMessageSize, getParams, hasMoreBytes, isCached, isRecached, parse, readByte, readByteArray, readBytes, readHash, readInt64, readStr, readUint32, readUint64, readVarInt, readVarInt, setSerializer, unsafeBitcoinSerialize
-
Field Details
-
parent
-
-
Constructor Details
-
ChildMessage
Deprecated.UseChildMessage(NetworkParameters)
instead. -
ChildMessage
-
ChildMessage
- Throws:
ProtocolException
-
ChildMessage
public ChildMessage(NetworkParameters params, byte[] payload, int offset, @Nullable Message parent, MessageSerializer serializer, int length) throws ProtocolException - Throws:
ProtocolException
-
-
Method Details
-
setParent
-
unCache
protected void unCache()Description copied from class:Message
To be called before any change of internal values including any setters. This ensures any cached byte array is removed.
Child messages of this object(e.g. Transactions belonging to a Block) will not have their internal byte caches invalidated unless they are also modified internally.
-
adjustLength
protected void adjustLength(int adjustment) -
adjustLength
protected void adjustLength(int newArraySize, int adjustment) - Overrides:
adjustLength
in classMessage
-
ChildMessage(NetworkParameters)
instead.