### Question:
PutInvariantSpanOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.PUT_INVARIANT_SPAN); dos.writeLong(to); dos.writeLong(invariantStart); dos.writeLong(width); dos.writeInt(ripIndex); } os.flush(); return os.toByteArray(); } PutInvariantSpanOp(DataInputStream dis);  PutInvariantSpanOp(long to, long invariantStart, long width, int ripIndex); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final long invariantStart; final int ripIndex; final long to; final long width; }### Answer:
@Test public void encodeDecode() throws Exception { PutInvariantSpanOp op = new PutInvariantSpanOp(100, 50, 1, 0); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.PUT_INVARIANT_SPAN, dis.readByte()); PutInvariantSpanOp decoded = new PutInvariantSpanOp(dis); assertEquals(op, decoded); }