Class ScriptChunk

java.lang.Object
org.bitcoinj.script.ScriptChunk

public class ScriptChunk extends Object
A script element that is either a data push (signature, pubkey, etc) or a non-push (logic, numeric, etc) operation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final byte[]
    For push operations, this is the vector to be pushed on the stack.
    final int
    Operation to be executed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScriptChunk(int opcode, byte[] data)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    If this chunk is an OP_N opcode returns the equivalent integer value.
    boolean
     
    boolean
    equalsOpCode(int opcode)
     
    int
     
    boolean
    If this chunk is a single byte of non-pushdata content (could be OP_RESERVED or some invalid Opcode)
    boolean
    Returns true if this chunk is pushdata content, including the single-byte pushdatas.
    boolean
    Called on a pushdata chunk, returns true if it uses the smallest possible way (according to BIP62) to push the data.
    int
     
    byte[]
     
     
    void
    Deprecated.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • opcode

      public final int opcode
      Operation to be executed. Opcodes are defined in ScriptOpCodes.
    • data

      @Nullable public final byte[] data
      For push operations, this is the vector to be pushed on the stack. For ScriptOpCodes.OP_0, the vector is empty. Null for non-push operations.
  • Constructor Details

    • ScriptChunk

      public ScriptChunk(int opcode, @Nullable byte[] data)
  • Method Details

    • equalsOpCode

      public boolean equalsOpCode(int opcode)
    • isOpCode

      public boolean isOpCode()
      If this chunk is a single byte of non-pushdata content (could be OP_RESERVED or some invalid Opcode)
    • isPushData

      public boolean isPushData()
      Returns true if this chunk is pushdata content, including the single-byte pushdatas.
    • decodeOpN

      public int decodeOpN()
      If this chunk is an OP_N opcode returns the equivalent integer value.
    • isShortestPossiblePushData

      public boolean isShortestPossiblePushData()
      Called on a pushdata chunk, returns true if it uses the smallest possible way (according to BIP62) to push the data.
    • write

      @Deprecated public void write(OutputStream stream) throws IOException
      Deprecated.
      Throws:
      IOException
    • toByteArray

      public byte[] toByteArray()
    • size

      public int size()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object