@Test public void testToByteArray_OP_PUSHDATA2() { byte[] bytes = new byte[0x0102]; RANDOM.nextBytes(bytes); byte[] expected = Bytes.concat(new byte[] { OP_PUSHDATA2, 0x02, 0x01 }, bytes); byte[] actual = new ScriptChunk(OP_PUSHDATA2, bytes).toByteArray(); assertArrayEquals(expected, actual); }
public byte[] toByteArray() { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { write(stream); } catch (IOException e) { throw new RuntimeException(e); } return stream.toByteArray(); }
ScriptChunk { public byte[] toByteArray() { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { write(stream); } catch (IOException e) { throw new RuntimeException(e); } return stream.toByteArray(); } }
ScriptChunk { public byte[] toByteArray() { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { write(stream); } catch (IOException e) { throw new RuntimeException(e); } return stream.toByteArray(); } ScriptChunk(int opcode, @Nullable byte[] data); }
ScriptChunk { public byte[] toByteArray() { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { write(stream); } catch (IOException e) { throw new RuntimeException(e); } return stream.toByteArray(); } ScriptChunk(int opcode, @Nullable byte[] data); boolean equalsOpCode(int opcode); boolean isOpCode(); boolean isPushData(); int decodeOpN(); boolean isShortestPossiblePushData(); void write(OutputStream stream); byte[] toByteArray(); int size(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
ScriptChunk { public byte[] toByteArray() { ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { write(stream); } catch (IOException e) { throw new RuntimeException(e); } return stream.toByteArray(); } ScriptChunk(int opcode, @Nullable byte[] data); boolean equalsOpCode(int opcode); boolean isOpCode(); boolean isPushData(); int decodeOpN(); boolean isShortestPossiblePushData(); void write(OutputStream stream); byte[] toByteArray(); int size(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); final int opcode; @Nullable
    final byte[] data; }