All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nervousync.beans.ip.path.TargetPath Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package org.nervousync.beans.ip.path;

import org.nervousync.utils.StringUtils;

/**
 * 

Jar path define

*

Jar路径定义

* * @author Steven Wee [email protected] * @version $Revision: 1.0.0 $ $Date: Jul 31, 2023 16:27:08 $ */ public class TargetPath { /** * Separator between JAR URL and the path within the JAR * JAR URL 和 JAR 内路径之间的分隔符 */ public static final String JAR_URL_SEPARATOR = "!/"; /** * Archive file path * 压缩文件路径 */ private final String filePath; /** * Entry path * 资源路径 */ private final String entryPath; /** *

Constructor for TargetPath

*

Jar路径定义的构造方法

* * @param filePath Archive file path * 压缩文件路径 * @param entryPath Entry path * 资源路径 */ private TargetPath(final String filePath, final String entryPath) { this.filePath = filePath; this.entryPath = entryPath; } /** *

Static method for parse resource location string to TargetPath instance

*

静态方法用于解析资源路径字符串为JarPath实例对象

* * @param resourceLocation the location String * 位置字符串 * * @return Parsed TargetPath instance or null if resource location string invalid * 解析后的 TargetPath 实例对象,如果位置字符串不是合法的资源路径则返回 null */ public static TargetPath parse(final String resourceLocation) { if (StringUtils.containsIgnoreCase(resourceLocation, JAR_URL_SEPARATOR)) { int index = resourceLocation.indexOf(JAR_URL_SEPARATOR); return new TargetPath(resourceLocation.substring(0, index), resourceLocation.substring(index + JAR_URL_SEPARATOR.length())); } return null; } /** *

Static method for generate TargetPath instance

*

静态方法用于解析资源路径字符串为JarPath实例对象

* * @param filePath Archive file path * 压缩文件路径 * @param entryPath Entry path * 资源路径 * * @return Generated TargetPath instance or null if filePath or entryPath is null * 生成的 TargetPath 实例对象,如果压缩文件路径或资源路径为 null 则返回 null */ public static TargetPath newInstance(final String filePath, final String entryPath) { if (filePath == null || filePath.isEmpty() || entryPath == null || entryPath.isEmpty()) { return null; } return new TargetPath(filePath, entryPath); } /** *

Getter method for file path

*

Jar文件路径的Getter方法

* * @return Jar file path * Jar文件路径 */ public String getFilePath() { return filePath; } /** *

Getter method for entry path

*

Jar资源路径的Getter方法

* * @return Jar entry path * Jar资源路径 */ public String getEntryPath() { return entryPath; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy