Class 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.

    • Field Detail

      • parent

        @Nullable
        protected Message parent
    • 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.

        Overrides:
        unCache in class Message
      • adjustLength

        protected void adjustLength​(int adjustment)
      • adjustLength

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