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
public abstract class ChildMessage extends Message
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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ChildMessage()
Deprecated.UseChildMessage(NetworkParameters)
instead.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
adjustLength(int adjustment)
protected void
adjustLength(int newArraySize, int adjustment)
void
setParent(Message parent)
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 Detail
-
parent
@Nullable protected Message parent
-
-
Constructor Detail
-
ChildMessage
@Deprecated protected ChildMessage()
Deprecated.UseChildMessage(NetworkParameters)
instead.
-
ChildMessage
public ChildMessage(NetworkParameters params)
-
ChildMessage
public ChildMessage(NetworkParameters params, byte[] payload, int offset) throws ProtocolException
- Throws:
ProtocolException
-
ChildMessage
public ChildMessage(NetworkParameters params, byte[] payload, int offset, @Nullable Message parent, MessageSerializer serializer, int length) throws ProtocolException
- Throws:
ProtocolException
-
-
Method Detail
-
setParent
public final void setParent(@Nullable Message parent)
-
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
-
-