@Test public void encodeDecode() throws Exception { ToggleOverlayOp op = new ToggleOverlayOp(new VariantSpan(100, 1), 10); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.TOGGLE_OVERLAY, dis.readByte()); ToggleOverlayOp decoded = new ToggleOverlayOp(dis); assertEquals(op, decoded); }
@Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os.toByteArray(); }
ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os.toByteArray(); } }
ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os.toByteArray(); } ToggleOverlayOp(DataInputStream dis);  ToggleOverlayOp(VariantSpan variantSpan, int linkTypeIndex); }
ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os.toByteArray(); } ToggleOverlayOp(DataInputStream dis);  ToggleOverlayOp(VariantSpan variantSpan, int linkTypeIndex); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os.toByteArray(); } ToggleOverlayOp(DataInputStream dis);  ToggleOverlayOp(VariantSpan variantSpan, int linkTypeIndex); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final int linkTypeIndex; final VariantSpan variantSpan; }