IOUtils.closeQuietly(in);
}
StringBuffer buf = new StringBuffer("");
if (imagedata != null) {
// Test if image date is image
FormatBase imageformat = FormatBase.determineFormat(imagedata);
if (!(imageformat.getType() == ImageConstants.I_NOT_SUPPORTED
| imageformat.getRtfTag() == "")) {
buf = new StringBuffer(imagedata.length * 3);
for (int i = 0; i < imagedata.length; i++) {
int iData = imagedata [i];
// Make positive byte
if (iData < 0) {
iData += 256;
}
if (iData < 16) {
// Set leading zero and append
buf.append('0');
}
buf.append(Integer.toHexString(iData));
}
buf.insert(0, "{\\*\\shppict{\\pict\\" + imageformat.getRtfTag() + " ");
buf.append("}");
buf.append("}");
}