import org.jivesoftware.smack.util.StringUtils;//引入包
XMPPConnection con;
byte[] bytes;
con = XmppUtils.getInstance().getConnection();
VCard vCard = new VCard();
vCard.load(con, ConfigEntity.uname + "@192.168.1.66");
bytes = LiaoYiLiaoMyInfo.readByte(ConfigEntity.userHeadImg);
String encodedImage = StringUtils.encodeBase64(bytes);
v.setAvatar(bytes, encodedImage);
v.setEncodedImage(encodedImage);
v.setField("PHOTO", "<TYPE>image/jpg</TYPE><BINVAL>" +
encodedImage
+ "</BINVAL>", true);
v.save(con);