/** * Gets the payload of message. * * @param message byte array representing the message. * @return byte array containing the payload. */ public byte[] getPayload(byte[] message) throws UnsupportedEncodingException { if (this == OPEN) { return getOpenPayload(message); } return ArrayUtils.subarray(message, length, message.length); }
/** * Get the message type for a received message. * * @param message byte array representing the message. * @return type of the message. */ public static MessageType getMessageType(byte[] message) { for (MessageType type : MessageType.values()) { if (isType(message, type)) { return type; } } throw new UnsupportedOperationException("could not find type for message m" + message + " v" + new String(message, StandardCharsets.UTF_8)); }
MessageType type = MessageType.getMessageType(bytes); parallelism = Integer.parseInt(values[2]); if (typeSerializer == null) { out = type.getPayload(bytes); typeSerializer = SerializeUtil.deserialize(out); for (byte[] b : unserialized) { out = type.getPayload(bytes); if (typeSerializer == null) { unserialized.add(out);