随笔分类 -  工具类

摘要:import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.io.*; /** * @Description: * @Author: Han * @CreateDate: 2022/9/7 **/ public 阅读全文
posted @ 2022-09-07 14:36 云村的王子 阅读(4694) 评论(0) 推荐(0) 编辑
摘要:public static void main(String[] args) { String aa = "5632.2"; //小数点前后是数字即可,无小数点后数据也ok System.out.println(aa.matches("^[-\\+]?[.\\d]*$")); //区别控制小数点后两 阅读全文
posted @ 2021-12-21 10:18 云村的王子 阅读(1796) 评论(0) 推荐(0) 编辑
摘要:1、使用String类型导出 定义自己的Converter,不使用默认的StringImageConverter 如果图片路径为空或者图片路径是错误的,返回相应的内容 import java.io.FileNotFoundException; import java.io.IOException; 阅读全文
posted @ 2021-09-15 17:08 云村的王子 阅读(3893) 评论(0) 推荐(0) 编辑
摘要:public static void main(String[] args) { Dimension screensize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int)screensize.getWidth(); i 阅读全文
posted @ 2021-07-30 13:33 云村的王子 阅读(415) 评论(0) 推荐(0) 编辑
摘要:/** * 校验时间 * * @param text * @return */ public static boolean checkTime(String text) { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try 阅读全文
posted @ 2021-06-17 16:41 云村的王子 阅读(390) 评论(0) 推荐(0) 编辑
摘要:兄弟们,代码直接用。 这里提供了三个接口,分别是 1、读取指定文件夹图片生成PDF 2、读取指定文件夹图片生成PDF并下载 3、将前台传过来的文件图片转换为PDF下载 import com.lowagie.text.Document; import com.lowagie.text.Document 阅读全文
posted @ 2021-06-17 10:40 云村的王子 阅读(467) 评论(0) 推荐(0) 编辑
摘要:代码如下: public class test01 { private static int DPI = 300; public static void main(String[] args) { String path = "E:\\002.jpg"; File file = new File(p 阅读全文
posted @ 2021-06-10 14:49 云村的王子 阅读(1180) 评论(0) 推荐(0) 编辑
摘要:代码如下: public static void main(String[] args) { try { BufferedImage bufferegImage = ImageIO.read(new File("C:\\YD\\2021-06-01\\temp\\094.tif")); ImageI 阅读全文
posted @ 2021-06-10 10:08 云村的王子 阅读(1002) 评论(0) 推荐(0) 编辑
摘要:将下面三层结合起来,请放心食用。 一、controller层 @RestController public class EasyExcelController { private Logger logger = LogManager.getLogger(EasyExcelController.cla 阅读全文
posted @ 2021-06-03 14:51 云村的王子 阅读(184) 评论(0) 推荐(0) 编辑
摘要:public static void main(String[] args) { String filePath = "E:/" + "1.txt"; String content = "这是txt文件"; FileWriter fw = null; try { File file = new Fi 阅读全文
posted @ 2021-06-03 11:27 云村的王子 阅读(5278) 评论(0) 推荐(0) 编辑
摘要:public CommonResp download() { FileOutputStream fos = null; BufferedInputStream bis = null; HttpURLConnection httpUrl = null; int size = 0; byte[] buf 阅读全文
posted @ 2021-06-03 11:20 云村的王子 阅读(136) 评论(0) 推荐(0) 编辑
摘要:public class MessageUtil { public static String md5(String msg) { String ret_msg = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); byte 阅读全文
posted @ 2021-05-28 15:52 云村的王子 阅读(84) 评论(2) 推荐(0) 编辑
摘要:在pom中添加依赖即可 <dependency> <groupId>com.twelvemonkeys.imageio</groupId> <artifactId>imageio-tiff</artifactId> <version>3.4.1</version> </dependency> 阅读全文
posted @ 2021-05-26 16:19 云村的王子 阅读(273) 评论(0) 推荐(0) 编辑
摘要:下面这些方法都可以封装到一个工具类中 /** * 获取当前时间的时间戳 */ public static int getCurrentTimeIntValue() { return (int) (System.currentTimeMillis() / 1000); } /** * 获取days天后 阅读全文
posted @ 2021-05-10 22:51 云村的王子 阅读(1124) 评论(0) 推荐(0) 编辑
摘要:SimpleDateFormat sdfYMD = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.SECOND,0); // 阅读全文
posted @ 2021-02-24 19:57 云村的王子 阅读(14120) 评论(0) 推荐(2) 编辑

点击右上角即可分享
微信分享提示