//获取文件后缀名 url为文件下载链接
URL uri = new URL(url);
URLConnection uc = uri.openConnection();
String fileName = uc.getHeaderField("Content-Disposition");
fileName = new String(fileName.getBytes("ISO-8859-1"), "GBK");
fileName = URLDecoder.decode(fileName.substring(fileName.indexOf("filename=")+9),"UTF-8");
fileName = fileName.replace("\"", "");
Java 根据文件下载链接获取文件后缀
最新推荐文章于 2024-09-13 16:12:01 发布