本文整理汇总了Java中org.apache.poi.ss.usermodel.PictureData.suggestFileExtension方法的典型用法代码示例。如果您正苦于以下问题:Java PictureData.suggestFileExtension方法的具体用法?Java PictureData.suggestFileExtension怎么用?Java PictureData.suggestFileExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.ss.usermodel.PictureData
的用法示例。
在下文中一共展示了PictureData.suggestFileExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPicture
import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
@SneakyThrows
public static String createPicture(PictureData picture) {
if (picture == null) return "null";
val extension = picture.suggestFileExtension();
val imageFileName = String.valueOf(WestId.next()) + "." + extension;
File file = new File(imageFileName);
file.deleteOnExit(); // comment out this for human assertion
@Cleanup val out = new FileOutputStream(file);
out.write(picture.getData());
return imageFileName;
}
示例2: PictureInfo
import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
public PictureInfo(PictureData data, int[] p, String border) {
StringBuilder buf = new StringBuilder();
buf.append("data:")
.append(data.getMimeType())
.append(";base64,");
buf.append(Base64.encodeBase64String(data.getData()));
this.uri = buf.toString();
this.p = p;
this.border = border;
this.data = data.getData();
this.mimeType = data.getMimeType();
this.ext = data.suggestFileExtension();
}
示例3: createImageData
import org.apache.poi.ss.usermodel.PictureData; //导入方法依赖的package包/类
public static ImageData createImageData(PictureData pic) {
return new ImageData(pic.getData(), pic.suggestFileExtension(), pic.getMimeType(), pic.getPictureType());
}