Example #1
0
  protected byte[] encodeContact(DHTTransportContact contact) {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      DataOutputStream dos = new DataOutputStream(baos);

      contact.exportContact(dos);

      dos.close();

      return (baos.toByteArray());

    } catch (Throwable e) {

      log(e);

      return (null);
    }
  }
Example #2
0
  protected byte[] encodePublishValue(DHTTransportContact contact) {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      DataOutputStream dos = new DataOutputStream(baos);

      dos.writeByte(0); // version

      contact.exportContact(dos);

      dos.close();

      return (baos.toByteArray());

    } catch (Throwable e) {

      log(e);

      return (new byte[0]);
    }
  }