@Test public void toByteArrayAndBack() { byte[] arrayA = delQuery.toByteArray(); byte[] arrayB; arrayB = new DeletionQuery(arrayA).toByteArray(); assertArrayEquals("The two arrays differ!", arrayA, arrayB); }
@Override public byte[] toByteArray() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { writeHeader(outputStream); outputStream.write(dhtKey.toByteArray()); } catch (IOException e) { log.error("Can't write to ByteArrayOutputStream.", e); } return outputStream.toByteArray(); }
DeletionQuery extends CommunicationPacket { @Override public byte[] toByteArray() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { writeHeader(outputStream); outputStream.write(dhtKey.toByteArray()); } catch (IOException e) { log.error("Can't write to ByteArrayOutputStream.", e); } return outputStream.toByteArray(); } }
DeletionQuery extends CommunicationPacket { @Override public byte[] toByteArray() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { writeHeader(outputStream); outputStream.write(dhtKey.toByteArray()); } catch (IOException e) { log.error("Can't write to ByteArrayOutputStream.", e); } return outputStream.toByteArray(); } DeletionQuery(Hash dhtKey);  DeletionQuery(byte[] data); }
DeletionQuery extends CommunicationPacket { @Override public byte[] toByteArray() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { writeHeader(outputStream); outputStream.write(dhtKey.toByteArray()); } catch (IOException e) { log.error("Can't write to ByteArrayOutputStream.", e); } return outputStream.toByteArray(); } DeletionQuery(Hash dhtKey);  DeletionQuery(byte[] data); Hash getDhtKey(); @Override byte[] toByteArray(); }
DeletionQuery extends CommunicationPacket { @Override public byte[] toByteArray() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { writeHeader(outputStream); outputStream.write(dhtKey.toByteArray()); } catch (IOException e) { log.error("Can't write to ByteArrayOutputStream.", e); } return outputStream.toByteArray(); } DeletionQuery(Hash dhtKey);  DeletionQuery(byte[] data); Hash getDhtKey(); @Override byte[] toByteArray();  }