@Test public void encode() throws Exception { ApplyOverlayOp op = new ApplyOverlayOp(new VariantSpan(1, 100), Sets.newHashSet(1, 10)); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.APPLY_OVERLAY, dis.read()); assertEquals(1, dis.readLong()); assertEquals(100, dis.readLong()); assertEquals(2, dis.readInt()); assertEquals(1, dis.readInt()); assertEquals(10, dis.readInt()); }
@Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : linkTypes) { if (i < 0) { throw new IOException("Tumbler pool index must be 0 or greater: " + i); } dos.writeInt(i); } } os.flush(); return os.toByteArray(); }
ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : linkTypes) { if (i < 0) { throw new IOException("Tumbler pool index must be 0 or greater: " + i); } dos.writeInt(i); } } os.flush(); return os.toByteArray(); } }
ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : linkTypes) { if (i < 0) { throw new IOException("Tumbler pool index must be 0 or greater: " + i); } dos.writeInt(i); } } os.flush(); return os.toByteArray(); } ApplyOverlayOp(DataInputStream dis);  ApplyOverlayOp(VariantSpan variantSpan, Set<Integer> linkTypes); }
ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : linkTypes) { if (i < 0) { throw new IOException("Tumbler pool index must be 0 or greater: " + i); } dos.writeInt(i); } } os.flush(); return os.toByteArray(); } ApplyOverlayOp(DataInputStream dis);  ApplyOverlayOp(VariantSpan variantSpan, Set<Integer> linkTypes); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : linkTypes) { if (i < 0) { throw new IOException("Tumbler pool index must be 0 or greater: " + i); } dos.writeInt(i); } } os.flush(); return os.toByteArray(); } ApplyOverlayOp(DataInputStream dis);  ApplyOverlayOp(VariantSpan variantSpan, Set<Integer> linkTypes); @Override byte[] encode(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final Set<Integer> linkTypes; final VariantSpan variantSpan; }