com.google.bitcoin.core
Class ChildMessage

java.lang.Object
  extended by com.google.bitcoin.core.Message
      extended by com.google.bitcoin.core.ChildMessage
All Implemented Interfaces:
Serializable
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.

Author:
git
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.bitcoin.core.Message
Message.LazyParseException
 
Field Summary
 
Fields inherited from class com.google.bitcoin.core.Message
bytes, checksum, cursor, length, MAX_SIZE, offset, params, parsed, parseLazy, parseRetain, protocolVersion, recached, UNKNOWN_LENGTH
 
Constructor Summary
protected ChildMessage()
           
  ChildMessage(NetworkParameters params)
           
  ChildMessage(NetworkParameters params, byte[] msg, int offset)
           
  ChildMessage(NetworkParameters params, byte[] msg, int offset, int protocolVersion)
           
  ChildMessage(NetworkParameters params, byte[] msg, int offset, int protocolVersion, Message parent, boolean parseLazy, boolean parseRetain, int length)
           
  ChildMessage(NetworkParameters params, byte[] msg, int offset, Message parent, boolean parseLazy, boolean parseRetain, int length)
           
 
Method Summary
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 com.google.bitcoin.core.Message
bitcoinSerialize, bitcoinSerialize, ensureParsed, getHash, getMessageSize, getParams, isCached, isParsed, isRecached, maybeParse, parseLite, unsafeBitcoinSerialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChildMessage

protected ChildMessage()

ChildMessage

public ChildMessage(NetworkParameters params)

ChildMessage

public ChildMessage(NetworkParameters params,
                    byte[] msg,
                    int offset,
                    int protocolVersion)
             throws ProtocolException
Throws:
ProtocolException

ChildMessage

public ChildMessage(NetworkParameters params,
                    byte[] msg,
                    int offset,
                    int protocolVersion,
                    Message parent,
                    boolean parseLazy,
                    boolean parseRetain,
                    int length)
             throws ProtocolException
Throws:
ProtocolException

ChildMessage

public ChildMessage(NetworkParameters params,
                    byte[] msg,
                    int offset)
             throws ProtocolException
Throws:
ProtocolException

ChildMessage

public ChildMessage(NetworkParameters params,
                    byte[] msg,
                    int offset,
                    @Nullable
                    Message parent,
                    boolean parseLazy,
                    boolean parseRetain,
                    int length)
             throws ProtocolException
Throws:
ProtocolException
Method Detail

setParent

public 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 after performing a lazy parse if necessary to ensure the object is fully populated.

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.

Overrides:
unCache in class Message

adjustLength

protected void adjustLength(int adjustment)

adjustLength

protected void adjustLength(int newArraySize,
                            int adjustment)
Overrides:
adjustLength in class Message


Copyright © 2014. All rights reserved.