Package org.bitcoinj.script
Class ScriptChunk
- java.lang.Object
-
- org.bitcoinj.script.ScriptChunk
-
public class ScriptChunk extends java.lang.Object
A script element that is either a data push (signature, pubkey, etc) or a non-push (logic, numeric, etc) operation.
-
-
Constructor Summary
Constructors Constructor Description ScriptChunk(int opcode, byte[] data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
decodeOpN()
If this chunk is an OP_N opcode returns the equivalent integer value.boolean
equals(java.lang.Object o)
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
isPushData()
Returns true if this chunk is pushdata content, including the single-byte pushdatas.boolean
isShortestPossiblePushData()
Called on a pushdata chunk, returns true if it uses the smallest possible way (according to BIP62) to push the data.int
size()
byte[]
toByteArray()
java.lang.String
toString()
void
write(java.io.OutputStream stream)
-
-
-
Field Detail
-
opcode
public final int opcode
Operation to be executed. Opcodes are defined inScriptOpCodes
.
-
data
@Nullable public final byte[] data
For push operations, this is the vector to be pushed on the stack. ForScriptOpCodes.OP_0
, the vector is empty. Null for non-push operations.
-
-
Method Detail
-
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
public void write(java.io.OutputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
toByteArray
public byte[] toByteArray()
-
size
public int size()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-