|
|
@@ -7,7 +7,6 @@ import com.github.jfcloud.gene.handler.MyCheck;
|
|
|
import com.github.jfcloud.gene.handler.MyJsonFilter;
|
|
|
import freemarker.template.Configuration;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import sun.misc.BASE64Encoder;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
@@ -76,38 +75,6 @@ public class WordUtil {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 图片转换
|
|
|
- * @param inputStream
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static String getImgFileToBase64(InputStream inputStream) {
|
|
|
- //将图片文件转化为字节数组字符串,并对其进行Base64编码处理
|
|
|
- byte[] buffer = null;
|
|
|
- //读取图片字节数组
|
|
|
- try {
|
|
|
- int count = 0;
|
|
|
- while (count == 0) {
|
|
|
- count = inputStream.available();
|
|
|
- }
|
|
|
- buffer = new byte[count];
|
|
|
- inputStream.read(buffer);
|
|
|
- } catch (IOException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- } finally {
|
|
|
- if (inputStream != null) {
|
|
|
- try {
|
|
|
- // 关闭inputStream流
|
|
|
- inputStream.close();
|
|
|
- } catch (IOException e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 对字节数组Base64编码
|
|
|
- return new BASE64Encoder().encode(buffer);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 在字符串左右填充字符串
|
|
|
*
|