Package net.tomp2p.message

Examples of net.tomp2p.message.Encoder


    int intVal = 42;

    Message m1 = Utils2.createDummyMessage();
    m1.intValue(intVal);
   
    Encoder encoder = new Encoder(null); // TODO signaturefactory?

    AlternativeCompositeByteBuf buf = AlternativeCompositeByteBuf.compBuffer(); // TODO what buffer to use?
   
    encoder.write(buf, m1, null);
   
    byte[] bytes = buf.array();
    writeToFile(bytes);
   
  }
View Full Code Here


 
  /**
   * Encodes a message into a buffer, such that it can be used as a message payload (piggybacked), stored, etc.
   */
  public static Buffer encodeMessage(Message message, SignatureFactory signatureFactory) throws InvalidKeyException, SignatureException, IOException {
    Encoder e = new Encoder(signatureFactory);
    AlternativeCompositeByteBuf buf = AlternativeCompositeByteBuf.compBuffer();
    e.write(buf, message, message.receivedSignature());
    return new Buffer(buf);
  }
View Full Code Here

TOP

Related Classes of net.tomp2p.message.Encoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.