* @return The {@link ChangePasswordReply}.
* @throws IOException
*/
public ChangePasswordReply decode( ByteBuffer buf ) throws IOException
{
ChangePasswordReplyModifier modifier = new ChangePasswordReplyModifier();
short messageLength = buf.getShort();
short protocolVersion = buf.getShort();
short encodedAppReplyLength = buf.getShort();
modifier.setProtocolVersionNumber( protocolVersion );
byte[] encodedAppReply = new byte[encodedAppReplyLength];
buf.get( encodedAppReply );
ApplicationReplyDecoder appDecoder = new ApplicationReplyDecoder();
ApplicationReply applicationReply = appDecoder.decode( encodedAppReply );
modifier.setApplicationReply( applicationReply );
int privateBytesLength = messageLength - HEADER_LENGTH - encodedAppReplyLength;
byte[] encodedPrivateMessage = new byte[privateBytesLength];
buf.get( encodedPrivateMessage );
PrivateMessageDecoder privateDecoder = new PrivateMessageDecoder();
PrivateMessage privateMessage = privateDecoder.decode( encodedPrivateMessage );
modifier.setPrivateMessage( privateMessage );
return modifier.getChangePasswordReply();
}