首页
友链
关于
免责声明
Search
1
王者营地战绩数据王者荣耀查询网页源码
6,258 阅读
2
群晖Active Backup for Business套件备份Linux服务器教程
4,387 阅读
3
影视分享
4,319 阅读
4
(亲测)Jrebel激活破解方式2019-08-21
4,293 阅读
5
centos7 安装及卸载 jekenis
3,576 阅读
日常
文章
后端
前端
Linux
异常
Flutter
分享
群辉
登录
Search
标签搜索
docker
springboot
Spring Boot
java
linux
Shiro
Graphics2D
图片
游戏账号交易
Mybatis
Spring Cloud
centos
脚本
Web Station
群辉
王者营地
战绩查询
平台对接
Spring Cloud Alibaba
nacos
绿林寻猫
累计撰写
249
篇文章
累计收到
26
条评论
首页
栏目
日常
文章
后端
前端
Linux
异常
Flutter
分享
群辉
页面
友链
关于
免责声明
搜索到
237
篇与
文章
的结果
2021-12-08
Java获取前一天的的日期
//Date d=new Date(System.currentTimeMillis()-1000*60*60*24*2);//计算前天 Date d=new Date(System.currentTimeMillis()-1000*60*60*24); SimpleDateFormat sp=new SimpleDateFormat("yyyy-MM-dd"); String zuotian=sp.format(d);//获取昨天日期
2021年12月08日
139 阅读
0 评论
0 点赞
2021-12-08
java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGCodec
图片压缩在windows下正常,linux服务器报java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGCodec本地开发,jre里有这个包,所以不会报错但是在新的 jdk 版本中,这个类不推荐使用了,使用 ImageIO.write 方法替代// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fos); // encoder.encode(image); ImageIO.write(image, "jpg", fos);
2021年12月08日
448 阅读
0 评论
0 点赞
2021-12-08
java调用接口,同时上传文件及数据
1.提交数据/** * POST报文客户端 * * @param url 调用地址字符串 * @param jsonParam 报文实体JSON * @return String * @author Al1en */ public static String httpPostWithForm(String url, JSONObject jsonParam) { URL u = null; HttpURLConnection con = null; // 构建请求参数 StringBuffer sb = new StringBuffer(); for (String s : jsonParam.keySet()) { sb.append(s); sb.append("="); sb.append(jsonParam.getString(s)); sb.append("&"); } System.out.println("send_url:" + url); System.out.println("send_data:" + sb.toString()); // 尝试发送请求 try { u = new URL(url); con = (HttpURLConnection) u.openConnection(); POST 只能为大写,严格限制,post会不识别 con.setRequestMethod("POST"); con.setDoOutput(true); con.setDoInput(true); con.setUseCaches(false); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); osw.write(sb.toString()); osw.flush(); osw.close(); } catch (Exception e) { e.printStackTrace(); } finally { if (con != null) { con.disconnect(); } } // 读取返回内容 StringBuffer buffer = new StringBuffer(); try { //一定要有返回值,否则无法把请求发送给server端。 BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")); String temp; while ((temp = br.readLine()) != null) { buffer.append(temp); buffer.append("\n"); } } catch (Exception e) { e.printStackTrace(); } return buffer.toString(); } 2.提交数据及文件 import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.util.HashMap; import java.util.Map; public class HttpPost { private static final String BOUNDARY = "-------45962402127348"; private static final String FILE_ENCTYPE = "multipart/form-data"; //存放数据 Map<String, String> textParams = new HashMap<String, String>(); //存放File文件 Map<String, File> fileparams = new HashMap<String, File>(); String url; public HttpPost(String url)throws Exception{ this.url = url; } public void setUrl(String url) { this.url = url; } public void addTextParams(String key,String value) { this.textParams.put(key, value); } public void addFileparams(String key,File file) { this.fileparams.put(key, file); } public String send()throws IOException{ InputStream post = post(this.url, this.textParams, this.fileparams); ByteArrayOutputStream out = new ByteArrayOutputStream(); int b; while ((b = post.read()) != -1) { out.write(b); } return new String(out.toByteArray()); } /** * * @param urlStr http请求路径 * @param params 请求参数 * @param images 上传文件 * @return */ public static InputStream post(String urlStr, Map<String, String> params, Map<String, File> images) { InputStream is = null; try { URL url = new URL(urlStr); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setConnectTimeout(5000); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestMethod("POST"); con.setRequestProperty("Connection", "Keep-Alive"); con.setRequestProperty("Charset", "UTF-8"); con.setRequestProperty("Content-Type", FILE_ENCTYPE + "; boundary=" + BOUNDARY); StringBuilder sb = null; DataOutputStream dos = new DataOutputStream(con.getOutputStream());; if (params != null) { sb = new StringBuilder(); for (String s : params.keySet()) { sb.append("--"); sb.append(BOUNDARY); sb.append("\r\n"); sb.append("Content-Disposition: form-data; name=\""); sb.append(s); sb.append("\"\r\n\r\n"); sb.append(params.get(s)); sb.append("\r\n"); } dos.write(sb.toString().getBytes()); } if (images != null) { for (String s : images.keySet()) { File f = images.get(s); sb = new StringBuilder(); sb.append("--"); sb.append(BOUNDARY); sb.append("\r\n"); sb.append("Content-Disposition: form-data; name=\""); sb.append(s); sb.append("\"; filename=\""); sb.append(f.getName()); sb.append("\"\r\n"); sb.append("Content-Type: multipart/form-data");//这里注意!如果上传的不是图片,要在这里改文件格式,比如txt文件,这里应该是text/plain sb.append("\r\n\r\n"); dos.write(sb.toString().getBytes()); FileInputStream fis = new FileInputStream(f); byte[] buffer = new byte[1024]; int len; while ((len = fis.read(buffer)) != -1) { dos.write(buffer, 0, len); } dos.write("\r\n".getBytes()); fis.close(); } sb = new StringBuilder(); sb.append("--"); sb.append(BOUNDARY); sb.append("--\r\n"); dos.write(sb.toString().getBytes()); } dos.flush(); if (con.getResponseCode() == 200){ is = con.getInputStream(); } dos.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return is; } public static void main(String[] args)throws Exception { HttpPost post = new HttpPost("http://***"); post.addTextParams("a", "1"); post.addTextParams("b", "hahah"); post.addTextParams("c", "你好"); post.addFileparams("verifyFace", new File("c:/123.jpg")); String result = post.send(); System.out.println(result); } }
2021年12月08日
100 阅读
0 评论
0 点赞
2021-12-08
Java SpringBoot 循环监听UDP同一个Socket实现接收与发送
SpringBoot实现项目启动监听UDP package com.hujiang.project.lz.faceRecognition; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; import java.io.*; import java.net.*; import java.util.logging.Logger; /* * 服务器端,实现基于UDP的用户登陆 */ @WebListener public class UDPServer implements ServletContextListener { public static Logger logger = Logger.getLogger(UDPServer.class.getName()); public static final int MAX_UDP_DATA_SIZE = 4096; public static final int UDP_PORT = 6007; public static DatagramPacket packet = null; public static DatagramSocket socket = null; @Override public void contextInitialized(ServletContextEvent sce) { try { logger.info("========启动一个线程,监听UDP数据报.PORT:" + UDP_PORT + "========="); // 启动一个线程,监听UDP数据报 new Thread(new UDPProcess(UDP_PORT)).start(); } catch (Exception e) { e.printStackTrace(); } } class UDPProcess implements Runnable { public UDPProcess(final int port) throws SocketException { //创建服务器端DatagramSocket,指定端口 socket = new DatagramSocket(port); } @Override public void run() { // TODO Auto-generated method stub logger.info("=======创建数据报,用于接收客户端发送的数据======"); while (true) { byte[] buffer = new byte[MAX_UDP_DATA_SIZE]; packet = new DatagramPacket(buffer, buffer.length); try { logger.info("=======此方法在接收到数据报之前会一直阻塞======"); socket.receive(packet); new Thread(new Process(packet)).start(); } catch (IOException e) { e.printStackTrace(); } } } } class Process implements Runnable { public Process(DatagramPacket packet) throws UnsupportedEncodingException { // TODO Auto-generated constructor stub logger.info("=======接收到的UDP信息======"); byte[] buffer = packet.getData();// 接收到的UDP信息,然后解码 // String srt1 = new String(buffer, "GBK").trim(); // logger.info("=======Process srt1 GBK======" + srt1); String srt2 = new String(buffer, "UTF-8").trim(); logger.info("=======Process srt2 UTF-8======" + srt2); // String srt3 = new String(buffer, "ISO-8859-1").trim(); // logger.info("=======Process srt3 ISO-8859-1======" + srt3); } @Override public void run() { // TODO Auto-generated method stub logger.info("====过程运行====="); try { logger.info("====向客户端响应数据====="); //1.定义客户端的地址、端口号、数据 InetAddress address = packet.getAddress(); int port = packet.getPort(); byte[] data2 = "{'request':'alive','errcode':'0'}".getBytes(); //2.创建数据报,包含响应的数据信息 DatagramPacket packet2 = new DatagramPacket(data2, data2.length, address, port); //3.响应客户端 socket.send(packet2); } catch (Exception e) { e.printStackTrace(); } } } @Override public void contextDestroyed(ServletContextEvent sce) { logger.info("========UDPListener摧毁========="); } } @ServletComponentScan Servlet扫描,启动时把servlet、filter、listener自动扫描注入@SpringBootApplication @ServletComponentScan public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } } 创建客户端测试 public static final String SERVER_HOSTNAME = "localhost"; // 服务器端口 public static final int SERVER_PORT = 6007; // 本地发送端口 public static final int LOCAL_PORT = 8888; public static void main(String[] args) { try { // 1,创建udp服务。通过DatagramSocket对象。 DatagramSocket socket = new DatagramSocket(LOCAL_PORT); // 2,确定数据,并封装成数据包。DatagramPacket(byte[] buf, int length, InetAddress // address, int port) byte[] buf = "你好,世界".getBytes(); DatagramPacket dp = new DatagramPacket(buf, buf.length, InetAddress.getByName(SERVER_HOSTNAME), SERVER_PORT); // 3,通过socket服务,将已有的数据包发送出去。通过send方法。 socket.send(dp); // 4,关闭资源。 socket.close(); } catch (IOException e) { e.printStackTrace(); } }
2021年12月08日
359 阅读
0 评论
0 点赞
2021-12-08
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/applicatio
异常问题:java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml' 可能是application.yml文件内容格式或层级的问题
2021年12月08日
292 阅读
0 评论
0 点赞
2021-12-08
Java8 日期时间
@Test public void test(){ testLocalDateTime(); } public void testLocalDateTime(){ // 获取当前的日期时间 LocalDateTime currentTime = LocalDateTime.now(); System.out.println("当前时间: " + currentTime);//当前时间: 2019-11-01T15:21:42.281 LocalDate date1 = currentTime.toLocalDate(); System.out.println("date1: " + date1);//date1: 2019-11-01 Month month = currentTime.getMonth(); int day = currentTime.getDayOfMonth(); int seconds = currentTime.getSecond(); System.out.println("月: " + month +", 日: " + day +", 秒: " + seconds);//月: NOVEMBER, 日: 1, 秒: 42 LocalDateTime date2 = currentTime.withDayOfMonth(10).withYear(2012); System.out.println("date2: " + date2);//2012-11-10T15:21:42.281 // 12 december 2014 LocalDate date3 = LocalDate.of(2014, Month.DECEMBER, 12); System.out.println("date3: " + date3);//2014-12-12 // 22 小时 15 分钟 LocalTime date4 = LocalTime.of(22, 15); System.out.println("date4: " + date4);//22:15 // 解析字符串 LocalTime date5 = LocalTime.parse("20:15:30"); System.out.println("date5: " + date5);//20:15:30 }
2021年12月08日
65 阅读
0 评论
0 点赞
2021-12-08
Java 8 Lambda 表达式
package com.example.demo; public class Java8Tester { public static void main(String args[]){ Java8Tester tester = new Java8Tester(); // 类型声明 MathOperation addition = (int a, int b) -> a + b; // 不用类型声明 MathOperation subtraction = (a, b) -> a - b; // 大括号中的返回语句 MathOperation multiplication = (int a, int b) -> { return a * b; }; // 没有大括号及返回语句 MathOperation division = (int a, int b) -> a / b; System.out.println("10 + 5 = " + tester.operate(10, 5, addition)); System.out.println("10 - 5 = " + tester.operate(10, 5, subtraction)); System.out.println("10 x 5 = " + tester.operate(10, 5, multiplication)); System.out.println("10 / 5 = " + tester.operate(10, 5, division)); // 不用括号 GreetingService greetService1 = message -> System.out.println("Hello " + message); // 用括号 GreetingService greetService2 = (message) -> System.out.println("Hello " + message); greetService1.sayMessage("Runoob"); greetService2.sayMessage("Google"); } interface MathOperation { int operation(int a, int b); } interface GreetingService { void sayMessage(String message); } private int operate(int a, int b, MathOperation mathOperation){ return mathOperation.operation(a, b); } } 输出结果:
2021年12月08日
125 阅读
0 评论
0 点赞
2021-12-08
java生成微信Sign签名
目录 Sign签名生成方法工具类工具类Sign签名生成方法工具类 import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; /** * 微信工具类 * @Author: LiuYong * @Date:2019/12/11 11:06 * @Description: TODO 微信工具类 */ public class WeChatTool { private static Logger logger = Logger.getLogger(WeChatTool.class.getName()); /**签名类型*/ public static final String MD5="MD5"; public static final String HMACSHA256="HMACSHA256"; public static void main(String[] args) { Map<String,Object> map = new HashMap<>(); map.put("appid","wxd930ea5d5a258f4f"); map.put("auth_code","123456"); map.put("body","test"); map.put("device_info","123"); map.put("mch_id","1900000109"); System.out.println(getSign(map,WeChatConstants.KEY,WeChatTool.HMACSHA256)); } /** * Sign签名生成方法 * @Author LiuYong * @Date 2019/12/11 11:13 * @Description TODO Sign签名生成方法 * @param map 自定义参数 * @param key 商户KEY * @param type 签名类型 * @return **/ public static String getSign(Map<String,Object> map,String key,String type){ StringBuilder sb = new StringBuilder(); String result =null; try{ ArrayList<String> list = new ArrayList<String>(); for(Map.Entry<String,Object> entry:map.entrySet()){ if(entry.getValue()!=""){ list.add(entry.getKey() + "=" + entry.getValue() + "&"); } } int size = list.size(); String [] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); for(int i = 0; i < size; i ++) { sb.append(arrayToSort[i]); } sb.append("key=" + key); result = sb.toString(); if(type.equals(MD5)){ result=MD5(result); }else if(type.equals(HMACSHA256)){ result=HMACSHA256(result,key); } }catch (Exception e){ logger.info("ERROR com.slf.utils.utils.wechat.WeChatTool.getSign :"+e.getMessage()); return null; } return result; } /** * 生成 MD5 * @Author LiuYong * @Date 2019/12/11 17:08 * @Description TODO 生成 MD5 * @param data 待处理数据 * @return 加密结果 **/ public static String MD5(String data) { StringBuilder sb = new StringBuilder(); try{ java.security.MessageDigest md = MessageDigest.getInstance("MD5"); byte[] array = md.digest(data.getBytes("UTF-8")); for (byte item : array) { sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3)); } }catch (Exception e){ logger.info("ERROR com.slf.utils.utils.wechat.WeChatTool.MD5 :"+e.getMessage()); return null; } return sb.toString().toUpperCase(); } /** * 生成 HMACSHA256 * @Author LiuYong * @Date 2019/12/11 17:00 * @Description TODO 生成 HMACSHA256 * @param data 待处理数据 * @param key 密钥 * @return 加密结果 **/ public static String HMACSHA256(String data, String key) { StringBuilder sb = new StringBuilder(); try{ Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256"); sha256_HMAC.init(secret_key); byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8")); for (byte item : array) { sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3)); } }catch (Exception e){ logger.info("ERROR com.slf.utils.utils.wechat.WeChatTool.HMACSHA256 :"+e.getMessage()); return null; } return sb.toString().toUpperCase(); } } 工具类 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.security.MessageDigest; /** * Md5加密方法 * @Author LiuYong * @Date 2019/12/11 11:17 * @Description TODO Md5加密方法 **/ public class Md5Utils { private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); private static byte[] md5(String s) { MessageDigest algorithm; try { algorithm = MessageDigest.getInstance("MD5"); algorithm.reset(); algorithm.update(s.getBytes("UTF-8")); byte[] messageDigest = algorithm.digest(); return messageDigest; } catch (Exception e) { log.error("MD5 Error...", e); } return null; } private static final String toHex(byte hash[]) { if (hash == null) { return null; } StringBuffer buf = new StringBuffer(hash.length * 2); int i; for (i = 0; i < hash.length; i++) { if ((hash[i] & 0xff) < 0x10) { buf.append("0"); } buf.append(Long.toString(hash[i] & 0xff, 16)); } return buf.toString(); } public static String hash(String s) { try { return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); } catch (Exception e) { log.error("not supported charset...{}", e); return s; } } }
2021年12月08日
166 阅读
0 评论
0 点赞
2021-12-08
java 最简单的xml与json相互转换
导入依赖 <!--xml转换--> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> <version>2.9.8</version> <scope>compile</scope> </dependency> 工具类 import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import java.util.logging.Logger; /** * json对象或字符串转xml * @Author: LiuYong * @Date:2019/12/11 11:21 * @Description: TODO json对象或字符串转xml */ public class JsonAndXmlUtils { private static Logger logger = Logger.getLogger(JsonAndXmlUtils.class.getName()); public static void main(String[] args) throws Exception { String jsonInput = "{\"nonce_str\":\"b927722419c52622651a871d1d9ed8b2\",\"device_info\":\"1000\",\"out_trade_no\":\"1405713376\",\"appid\":\"wx2421b1c4370ec43b\",\"total_fee\":\"1\",\"sign\":\"3CA89B5870F944736C657979192E1CF4\",\"trade_type\":\"JSAPI\",\"attach\":\"att1\",\"body\":\"JSAPI支付测试\",\"mch_id\":\"10000100\",\"notify_url\":\"http://wxpay.weixin.qq.com/pub_v2/pay/notify.php\",\"spbill_create_ip\":\"127.0.0.1\"}\n"; String jsonToXml = JsonAndXmlUtils.jsonToXml(jsonInput); System.out.println("jsonToXml:"+jsonToXml); JSONObject jsonObject = xmlToJson(jsonToXml); System.out.println("xmlToJson:"+jsonObject.toJSONString()); } /** * xml字符串转json对象 * @Author LiuYong * @Date 2019/12/11 11:40 * @Description TODO xml字符串转json对象 * @param xmlStr * @return JSONObject **/ public static JSONObject xmlToJson(String xmlStr){ XmlMapper xmlMapper = new XmlMapper(); JSONObject jsonObject1=null; try{ jsonObject1 = xmlMapper.readValue(xmlStr, JSONObject.class); }catch (Exception e){ logger.info("ERROR com.slf.utils.utils.JsonAndXmlUtils.xmlToJson 异常:"+e.getMessage()); } return jsonObject1; } /** * json字符串转xml字符串 * @Author LiuYong * @Date 2019/12/11 11:45 * @Description TODO json字符串转xml字符串 * @param json * @return String **/ public static String jsonToXml(String json){ JSONObject jsonObject = JSONObject.parseObject(json); XmlMapper xmlMapper = new XmlMapper(); String s = null; try{ s = xmlMapper.writeValueAsString(jsonObject); }catch (Exception e){ logger.info("ERROR com.slf.utils.utils.JsonAndXmlUtils.jsonToXml 异常:"+e.getMessage()); } return s; } }
2021年12月08日
191 阅读
0 评论
0 点赞
2021-12-08
java获取视频时长及判断视频横竖拍摄
<dependency> <groupId>ws.schild</groupId> <artifactId>jave-all-deps</artifactId> <version>2.5.1</version> </dependency> public AjaxResult uploadFileVideo(MultipartFile file) throws Exception { try { // 上传文件路径 String filePath = Global.getUploadPath(); // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file , MimeTypeUtils.MEDIA_EXTENSION); String url = serverConfig.getUrl() + fileName; String actualFileName = fileName.substring(fileName.indexOf("/",10)); String actualUrl = filePath + actualFileName; File temp = new File(actualUrl); AjaxResult ajax = AjaxResult.success(); try { double duration = getVedioTime(temp); Long limit = 10L; if(duration <=0 ){ temp.delete(); return AjaxResult.error("视频损坏"); }else if(duration > limit){ temp.delete(); return AjaxResult.error("视频时长不能超过"+limit+"秒"); } ajax.put("duration", duration); } catch (Exception e){ e.printStackTrace(); temp.delete(); return AjaxResult.error("视频解析失败"); } ajax.put("fileName", fileName); ajax.put("url", url); ajax.put("judge", judgeVerticalAndHorizontal(file)); return ajax; } catch (Exception e) { return AjaxResult.error(e.getMessage()); } } /** * @author Uncle * @Description TODO 判断视频纵向还是横向 * @Date 2020/07/27 11:50 * @param * @return 1 横 0 竖 */ public int judgeVerticalAndHorizontal(MultipartFile file){ float v = 0F; try{ File tempFile = FileUploadUtils.MultipartFileToFile(file); MultimediaObject instance = new MultimediaObject(tempFile); ws.schild.jave.MultimediaInfo m = instance.getInfo(); //> 1 说明是横的。< 1说明是竖着的 v = ((float) m.getVideo().getSize().getWidth()) / ((float) m.getVideo().getSize().getHeight()); }catch (Exception e){ e.printStackTrace(); } return v>1?1:0; } /** 获取视频时长:秒 * * @param file * @return */ public static Long getVedioTime(File file) { try { MultimediaObject instance = new MultimediaObject(file); ws.schild.jave.MultimediaInfo result = instance.getInfo(); long ls = result.getDuration() / 1000; return ls; } catch (Exception e) { e.printStackTrace(); } return 0L; }/** * 功能描述 :MultipartFile转file对象 * @author Mr.LiuYong * @date 2019/5/10 18:30 * @param * @return */ public static File MultipartFileToFile(MultipartFile multiFile) { // 获取文件名 String fileName = multiFile.getOriginalFilename(); // 获取文件后缀 String prefix = fileName.substring(fileName.lastIndexOf(".")); // 用当前时间作为文件名,防止生成的临时文件重复 try { File file = File.createTempFile(System.currentTimeMillis() + "", prefix); multiFile.transferTo(file); return file; } catch (Exception e) { e.printStackTrace(); } return null; }
2021年12月08日
136 阅读
0 评论
0 点赞
1
...
17
18
19
...
24