private void parseProfileClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { int payloadLimitPosition = buf.position() + payloadLength; ProfileClientSync profileSync = new ProfileClientSync(); profileSync.setProfileBody(getNewByteBuffer(buf, buf.getInt())); while (buf.position() < payloadLimitPosition) { byte fieldId = buf.get(); // reading unused reserved field buf.get(); switch (fieldId) { case PUBLIC_KEY_FIELD_ID: profileSync.setEndpointPublicKey(getNewByteBuffer(buf, getIntFromUnsignedShort(buf))); break; case ACCESS_TOKEN_FIELD_ID: profileSync.setEndpointAccessToken(getUtf8String(buf)); break; default: break; } } sync.setProfileSync(profileSync); }
private static ProfileClientSync convert(ProfileSyncRequest source) { if (source == null) { return null; } ProfileClientSync sync = new ProfileClientSync(); sync.setEndpointAccessToken(source.getEndpointAccessToken()); sync.setEndpointPublicKey(source.getEndpointPublicKey()); sync.setProfileBody(source.getProfileBody()); return sync; }