reghao пре 2 година
родитељ
комит
024dd334db

+ 0 - 130
jdk/src/main/java/cn/reghao/jutil/jdk/http/util/UrlFormatter.java

@@ -1,130 +0,0 @@
-package cn.reghao.jutil.jdk.http.util;
-
-/**
- * @author reghao
- * @date 2021-03-15 12:33:44
- */
-public class UrlFormatter {
-    /**
-     * 从 http/https url 中提取出域名
-     * https://twitter.com/Milkytutu/status/1264213127396114433 -> https://twitter.com
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午12:13
-     */
-    public static String getDomain(String url) {
-        if (url.startsWith("https://")) {
-            String host = url.split("https://")[1].split("/")[0];
-            return "https://" + host;
-        } else {
-            String host = url.split("http://")[1].split("/")[0];
-            return "http://" + host;
-        }
-    }
-
-    /**
-     * 从 http/https url 中提取出主机
-     * https://twitter.com/Milkytutu/status/1264213127396114433 -> twitter.com
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午12:13
-     */
-    public static String getHost(String url) {
-        if (url.startsWith("https://")) {
-            return url.split("https://")[1].split("/")[0];
-        } else {
-            return url.split("http://")[1].split("/")[0];
-        }
-    }
-
-    /**
-     * https://cdn.91p07.com//m3u8/442614/442614.m3u8?st=xHX459guiAmx5CsRJbLXyQ&e=1615796818
-     * -> https://cdn.91p07.com//m3u8/442614
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午2:31
-     */
-    public static String getPrefix(String url) {
-        String noParamsUrl = url.split("\\?")[0];
-        return noParamsUrl.substring(0, noParamsUrl.lastIndexOf("/"));
-    }
-
-    /**
-     * https://cdn.91p07.com//m3u8/442614/442614.m3u8?st=xHX459guiAmx5CsRJbLXyQ&e=1615796818
-     * -> https://cdn.91p07.com//m3u8/442614/442614.m3u8
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午2:33
-     */
-    public static String getUrlWithNoParams(String url) {
-        return url.split("\\?")[0];
-    }
-
-    /**
-     * 从 url 中取出指定参数的值
-     * http://91porn.com/uprofile.php?UID=b583fKPwaC8HuUDsIRbfEq9scGe1J90POTljHJwUJ998WRZq -> UID
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午12:38
-     */
-    public static String getParamValue(String url, String name) {
-        String params = url.split("\\?")[1];
-        for (String kv : params.split("&")) {
-            String[] arr = kv.split("=");
-            if (arr.length != 2) {
-                return null;
-            }
-
-            if (name.equals(arr[0])) {
-                return arr[1];
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * https://video.twimg.com/ext_tw_video/1351933827732525056/pu/vid/3000/6000/320x544/RTM9oDMcLYnTfg_k.ts?name=value
-     * -> RTM9oDMcLYnTfg_k.ts
-     *
-     * @param
-     * @return
-     * @date 2021-03-15 下午9:36
-     */
-    public static String getFilename(String url) {
-        String noParamsUrl = url.split("\\?")[0];
-        int index = noParamsUrl.lastIndexOf("/");
-        return noParamsUrl.substring(index+1);
-    }
-
-    /**
-     * https://cdn.91p07.com//m3u8/442614/442614.m3u8?st=xHX459guiAmx5CsRJbLXyQ&e=1615796818 ->
-     * https://cdn.91p07.com//m3u8/442614/442614.m3u8
-     *
-     * @param
-     * @return
-     * @date 2021-11-26 上午11:17
-     */
-    public static String getUrlWithoutParam(String url) {
-        return url.split("\\?")[0];
-    }
-
-    /**
-     * 提取 uri
-     * http://static.reghao.icu/tnb/vid/img/vidcover/eY9G0Zpnqe.jpg -> /tnb/vid/img/vidcover/eY9G0Zpnqe.jpg
-     *
-     * @param
-     * @return
-     * @date 2021-11-24 上午9:47
-     */
-    public static String getUri(String url) {
-        String url1 = url.replaceFirst("^(http|https)://", "");
-        int idx = url1.indexOf("/");
-        return url1.substring(idx);
-    }
-}

+ 0 - 14
jdk/src/main/java/cn/reghao/jutil/jdk/io/FileType.java

@@ -1,14 +0,0 @@
-package cn.reghao.jutil.jdk.io;
-
-import cn.reghao.jutil.jdk.shell.Shell;
-
-/**
- * @author reghao
- * @date 2023-06-15 14:08:45
- */
-public class FileType {
-    public static String getMediaType(String srcPath) {
-        String cmd = String.format("/bin/file -b --mime-type \"%s\"", srcPath);
-        return Shell.execWithResult(cmd);
-    }
-}

+ 0 - 27
jdk/src/main/java/cn/reghao/jutil/jdk/io/FileUtils.java

@@ -1,27 +0,0 @@
-package cn.reghao.jutil.jdk.io;
-
-import java.io.File;
-
-/**
- * 参照 org.apache.commons.io.FileUtils 的一个实现
- *
- * @author reghao
- * @date 2023-03-01 15:36:45
- */
-public class FileUtils {
-    public static void copyDirectory(File srcDir, File destDir) {
-    }
-
-    public static void copyFileToDirectory(File srcFile, File destDir) {
-    }
-
-    public static void forceMkdir(File directory) {
-    }
-
-    public static void cleanDirectory(File directory) {
-    }
-
-    public static void deleteQuietly(File file) {
-
-    }
-}

+ 0 - 22
jdk/src/main/java/cn/reghao/jutil/jdk/security/Salt.java

@@ -1,22 +0,0 @@
-package cn.reghao.jutil.jdk.security;
-
-import java.security.SecureRandom;
-import java.util.Base64;
-
-/**
- * @author reghao
- * @date 2019-04-05 12:23:47
- */
-@Deprecated
-public class Salt {
-    private static SecureRandom random = new SecureRandom();
-
-    /**
-     * @return 盐值
-     * @date 2019-04-05 12:28:08
-     */
-    public static String get(int len) {
-        byte[] seed = random.generateSeed(len);
-        return Base64.getEncoder().encodeToString(seed);
-    }
-}

+ 0 - 1
tool/src/main/java/cn/reghao/jutil/tool/http/BaseWebRequest.java

@@ -1,6 +1,5 @@
 package cn.reghao.jutil.tool.http;
 
-import cn.reghao.jutil.jdk.text.TextFile;
 import cn.reghao.jutil.tool.http.util.FakeDnsResolver;
 import cn.reghao.jutil.tool.http.util.MyConnectionSocketFactory;
 import cn.reghao.jutil.tool.http.util.MySSLConnectionSocketFactory;