Package org.bitcoinj.script
Class ScriptChunk
- java.lang.Object
-
- org.bitcoinj.script.ScriptChunk
-
public class ScriptChunk extends java.lang.ObjectA 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 intdecodeOpN()If this chunk is an OP_N opcode returns the equivalent integer value.booleanequals(java.lang.Object o)booleanequalsOpCode(int opcode)inthashCode()booleanisOpCode()If this chunk is a single byte of non-pushdata content (could be OP_RESERVED or some invalid Opcode)booleanisPushData()Returns true if this chunk is pushdata content, including the single-byte pushdatas.booleanisShortestPossiblePushData()Called on a pushdata chunk, returns true if it uses the smallest possible way (according to BIP62) to push the data.intsize()byte[]toByteArray()java.lang.StringtoString()voidwrite(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:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-