Class Message

    • Method Detail

      • unCache

        protected void unCache()

        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.

      • bitcoinSerialize

        public final byte[] bitcoinSerialize()

        Serialize this message to a byte array that conforms to the bitcoin wire protocol.

        Returns:
        a byte array
      • unsafeBitcoinSerialize

        @Deprecated
        public byte[] unsafeBitcoinSerialize()
        Deprecated.
      • bitcoinSerializeToStream

        protected void bitcoinSerializeToStream​(java.io.OutputStream stream)
                                         throws java.io.IOException
        Serializes this message to the provided stream. If you just want the raw bytes use bitcoinSerialize().
        Throws:
        java.io.IOException
      • getMessageSize

        public int getMessageSize()
        Return the size of the serialized message. Note that if the message was deserialized from a payload, this size can differ from the size of the original payload.
        Returns:
        size of the serialized message in bytes
      • readInt32

        protected int readInt32()
                         throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readUint32

        protected long readUint32()
                           throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readInt64

        protected long readInt64()
                          throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readUint64

        protected java.math.BigInteger readUint64()
                                           throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readVarInt

        protected VarInt readVarInt()
                             throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readBytes

        protected byte[] readBytes​(int length)
                            throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readByte

        protected byte readByte()
                         throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readByteArray

        protected byte[] readByteArray()
                                throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readStr

        protected java.lang.String readStr()
                                    throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • readHash

        protected Sha256Hash readHash()
                               throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • skipBytes

        protected void skipBytes​(int numBytes)
                          throws java.nio.BufferUnderflowException
        Throws:
        java.nio.BufferUnderflowException
      • getParams

        public NetworkParameters getParams()
        Network parameters this message was created with.