* @return The {@link ChangePasswordRequest}.
* @throws IOException
*/
public ChangePasswordRequest decode( ByteBuffer buf ) throws IOException
{
ChangePasswordRequestModifier modifier = new ChangePasswordRequestModifier();
buf.getShort(); // message length
modifier.setProtocolVersionNumber( buf.getShort() );
short authHeaderLength = buf.getShort();
byte[] undecodedAuthHeader = new byte[authHeaderLength];
buf.get( undecodedAuthHeader, 0, authHeaderLength );
ApplicationRequestDecoder decoder = new ApplicationRequestDecoder();
ApplicationRequest authHeader = decoder.decode( undecodedAuthHeader );
modifier.setAuthHeader( authHeader );
byte[] encodedPrivate = new byte[buf.remaining()];
buf.get( encodedPrivate, 0, buf.remaining() );
PrivateMessageDecoder privateDecoder = new PrivateMessageDecoder();
PrivateMessage privMessage = privateDecoder.decode( encodedPrivate );
modifier.setPrivateMessage( privMessage );
return modifier.getChangePasswordMessage();
}