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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
If this chunk is an OP_N opcode returns the equivalent integer value.boolean
boolean
equalsOpCode
(int opcode) int
hashCode()
boolean
isOpCode()
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
size()
byte[]
toString()
void
write
(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()
-