Class Encoder

java.lang.Object
marauroa.common.net.Encoder

public class Encoder extends Object
This class encodes a Message as a stream of bytes. Encoder follows singleton pattern.
Author:
miguel
  • Method Details

    • get

      public static Encoder get()
      Returns an unique instance of encoder
      Returns:
      an unique instance of encoder
    • encode

      public byte[] encode(Message msg) throws IOException
      This method uses the Marauroa protocol to encode a Message as a stream of bytes.
      Parameters:
      msg - The message to encode
      Returns:
      a byte array
      Throws:
      IOException - if there is any error encoding the message.