public ImageItem(String name, byte[] content) throws WeiboException {
String imgtype = null;
try {
imgtype = getContentType(content);
} catch (IOException e) {
throw new WeiboException(e);
}
if (imgtype != null
&& (imgtype.equalsIgnoreCase("image/gif") || imgtype.equalsIgnoreCase("image/png") || imgtype
.equalsIgnoreCase("image/jpeg"))) {
this.content = content;
this.name = name;
this.contentType = imgtype;
} else {
throw new WeiboException("Unsupported image type, Only Suport JPG ,GIF,PNG!");
}
}