コード例 #1
0
  public static Message messageParser(ByteBuffer buffer)
      throws IOException, JxtaHeaderParserException, JxtaBodyParserException {

    MessagePackageHeader header = new MessagePackageHeader();
    if (header.readHeader(buffer)) {
      MimeMediaType msgMime = header.getContentTypeHeader();
      Message msg = WireFormatMessageFactory.fromBuffer(buffer, msgMime, null);
      return msg;
    } else throw new JxtaHeaderParserException("Error on header parser");
  }
コード例 #2
0
 public static Message processMessage(ByteBuffer buffer, MessagePackageHeader header)
     throws IOException, JxtaBodyParserException {
   MimeMediaType msgMime = header.getContentTypeHeader();
   Message msg = WireFormatMessageFactory.fromBuffer(buffer, msgMime, null);
   return msg;
 }