|
@@ -1,5 +1,6 @@
|
|
|
package com.fdkankan.common.util;
|
|
|
|
|
|
+import cn.hutool.core.util.ZipUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import it.sauronsoftware.jave.*;
|
|
|
import java.net.MalformedURLException;
|
|
@@ -1030,66 +1031,20 @@ public class FileUtils {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
-// try{
|
|
|
-// String path = "H:\\test";
|
|
|
-// InputStream is = null;
|
|
|
-// String url = "https://file.api.weixin.qq.com/cgi-bin/media/get?access_token=41_veJ0V1PKdwBerxV6qcgty6opVroUYq5xgGG2uaK2f3PNBZNYttxNkTAHWyMt3AYb7iNn7cvpm87sXQhxBlhd6dBekczYR8-j49Hv85HMIV6HVsaMhjYE0QKtJ1C-HFfmsICMaSuvOBczkro5GDEeACAZWX&media_id=mXE_24SEX4-xfg0vB36KnfnkAHaFla5Fz4app1rgFiZDUtUJv04cQgJTOXHN32mm";
|
|
|
-// URL urlGet = new URL(url);
|
|
|
-// HttpURLConnection http = (HttpURLConnection) urlGet
|
|
|
-// .openConnection();
|
|
|
-// http.setRequestMethod("GET"); // 必须是get方式请求
|
|
|
-// http.setRequestProperty("Content-Type",
|
|
|
-// "application/x-www-form-urlencoded");
|
|
|
-// http.setDoOutput(true);
|
|
|
-// http.setDoInput(true);
|
|
|
-// System.setProperty("sun.net.client.defaultConnectTimeout", "30000");// 连接超时30秒
|
|
|
-// System.setProperty("sun.net.client.defaultReadTimeout", "30000"); // 读取超时30秒
|
|
|
-// http.connect();
|
|
|
-// // 获取文件转化为byte流
|
|
|
-// is = http.getInputStream();
|
|
|
-// File dic = new File(path);
|
|
|
-// if(!dic.exists())
|
|
|
-// {
|
|
|
-// dic.mkdirs();
|
|
|
-// }
|
|
|
-// File voice = new File(path+File.separator+ ConstantFileName.WECHAT_VOICE_NAME+".amr");
|
|
|
-// if(voice.exists())
|
|
|
-// {
|
|
|
-// FileUtils.deleteFile(path+File.separator+ConstantFileName.WECHAT_VOICE_NAME+".amr");
|
|
|
-// }
|
|
|
-// FileUtils.saveImageToDisk(null, null, ConstantFileName.WECHAT_VOICE_NAME, path+File.separator, is);
|
|
|
-// System.out.println("下载完成");
|
|
|
-
|
|
|
-// FileUtils.zipFile("F:\\test.zip", "F:\\downloads\\v3local");
|
|
|
-
|
|
|
-// ZipOutputStream out = new ZipOutputStream(new FileOutputStream("F:\\test.zip"));
|
|
|
-// File file = new File("F:\\test\\aaa\\sdf.jpg");
|
|
|
-// FileInputStream in = new FileInputStream(file);
|
|
|
-// FileUtils.zipTest(out, "aaa\\sdf.jpg", in);
|
|
|
-// out.close();
|
|
|
-//
|
|
|
-// File file = new File("F:\\test");
|
|
|
-// List<String> list = FileUtils.list(file);
|
|
|
-// for (String s : list) {
|
|
|
-// System.out.println(s);
|
|
|
-// }
|
|
|
-
|
|
|
-// byte[] bytesFromUrl = FileUtils.getBytesFromUrl(
|
|
|
-// "https://4dkankan.oss-cn-shenzhen.aliyuncs.com/"
|
|
|
-// + "data/datat-ieXdyGl6Md/mesh/texture1.jpg");
|
|
|
-// FileOutputStream out = new FileOutputStream(new File("F:\\texture1.jpg"));
|
|
|
-// out.write(bytesFromUrl);
|
|
|
-
|
|
|
-// List<String> test = null;
|
|
|
-// List<String> collect = test.stream().map(t -> {
|
|
|
-// return t;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-
|
|
|
-
|
|
|
-// }catch (Exception e){
|
|
|
-// e.printStackTrace();
|
|
|
+
|
|
|
+// ZipUtil.zip("F:\\test\\images", "F:\\test\\images.zip", false);
|
|
|
+// FileUtils.zipFile("F:\\test\\images.zip", "F:\\test\\images");
|
|
|
+// List<String> fileList = FileUtil.getFileList("F:\\test\\images\\");
|
|
|
+// for (String s : fileList) {
|
|
|
+// System.out.println(s);
|
|
|
+// }
|
|
|
+
|
|
|
+// List<String> keyList = cn.hutool.core.io.FileUtil.("F:\\test\\images\\");
|
|
|
+// for (String s : keyList) {
|
|
|
+// System.out.println(s);
|
|
|
// }
|
|
|
- FileUtils.decompress("F:\\test\\KJ-t-VJNe28ZImv_images_展厅全景图.zip", "F:\\test\\aaa");
|
|
|
+
|
|
|
+ cn.hutool.core.io.FileUtil.copy("F:\\test2\\1.txt", "F:\\test1\\1.txt", true);
|
|
|
|
|
|
}
|
|
|
|