Package org.bitcoinj.script
Class ScriptChunk
java.lang.Object
org.bitcoinj.script.ScriptChunk
A script element that is either a data push (signature, pubkey, etc) or a non-push (logic, numeric, etc) operation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintIf this chunk is an OP_N opcode returns the equivalent integer value.booleanbooleanequalsOpCode(int opcode) inthashCode()booleanisOpCode()If this chunk is a single byte of non-pushdata content (could be OP_RESERVED or some invalid Opcode)booleanReturns true if this chunk is pushdata content, including the single-byte pushdatas.booleanCalled on a pushdata chunk, returns true if it uses the smallest possible way (according to BIP62) to push the data.intsize()byte[]toString()voidwrite(OutputStream stream)
-
Field Details
-
opcode
public final int opcodeOperation to be executed. Opcodes are defined inScriptOpCodes. -
data
@Nullable public final byte[] dataFor push operations, this is the vector to be pushed on the stack. ForScriptOpCodes.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
- Throws:
IOException
-
toByteArray
public byte[] toByteArray() -
size
public int size() -
toString
-
equals
-
hashCode
public int hashCode()
-