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"); }
public static Message processMessage(ByteBuffer buffer, MessagePackageHeader header) throws IOException, JxtaBodyParserException { MimeMediaType msgMime = header.getContentTypeHeader(); Message msg = WireFormatMessageFactory.fromBuffer(buffer, msgMime, null); return msg; }