Skip to content

Commit

Permalink
🔥 upgrade version 1.5.0 upgrade add other nio util
Browse files Browse the repository at this point in the history
  • Loading branch information
lunasaw committed Aug 18, 2021
1 parent eee4eaa commit c9c3228
Show file tree
Hide file tree
Showing 50 changed files with 23,326 additions and 1,488 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ www.isczy.tk luna-common
<dependency>
<groupId>io.github.lunasaw</groupId>
<artifactId>luna-common</artifactId>
<version>1.4.6</version>
<version>1.5.0</version>
</dependency>

```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>io.github.lunasaw</groupId>
<artifactId>luna-common</artifactId>
<name>luna-common</name>
<version>1.4.8</version>
<version>1.5.0</version>
<description>common is project which contains common utils</description>
<url>https://github.com/lunasaw/luna-common</url>

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/luna/common/calendarist/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 农历计算相关操作
*
* @author [email protected]
* 2021/8/18
*/
package com.luna.common.calendarist;
94 changes: 94 additions & 0 deletions src/main/java/com/luna/common/china/NationalityEnum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.luna.common.china;

/**
* @author [email protected]
* 2021/8/18
*/
public enum NationalityEnum {

/** 中国56个民族 */
HAN("01", "汉族"),
MONGOL("02", "蒙古族"),
HUI("03", "回族"),
TIBETAN("04", "藏族"),
UYGHUR("05", "维吾尔族"),
MIAO("06", "苗族"),
YI("07", "彝族"),
ZHUANG("08", "壮族"),
BUYEI("09", "布依族"),
KOREAN("10", "朝鲜族"),
MANCHU("11", "满族"),
DONG("12", "侗族"),
YAO("13", "瑶族"),
BAI("14", "白族"),
TUJIA("15", "土家族"),
HANI("16", "哈尼族"),
KAZAK("17", "哈萨克族"),
DAI("18", "傣族"),
LI("19", "黎族"),
LISU("20", "傈僳族"),
VA("21", "佤族"),
SHE("22", "畲族"),
GAOSHAN("23", "高山族"),
LAHU("24", "拉祜族"),
SUI("25", "水族"),
DONGXIANG("26", "东乡族"),
NAXI("27", "纳西族"),
JINGPO("28", "景颇族"),
KIRGIZ("29", "柯尔克孜族"),
TU("30", "土族"),
DAUR("31", "达斡尔族"),
MULAO("32", "仫佬族"),
QIANG("33", "羌族"),
BLANG("34", "布朗族"),
SALAR("35", "撒拉族"),
MAONAN("36", "毛南族"),
GELAO("37", "仡佬族"),
XIBE("38", "锡伯族"),
ACHANG("39", "阿昌族"),
PUMI("40", "普米族"),
TAJIK("41", "塔吉克族"),
NU("42", "怒族"),
UZBEK("43", "乌孜别克族"),
RUSSIANS("44", "俄罗斯族"),
EWENKI("45", "鄂温克族"),
DEANG("46", "德昂族"),
BONAN("47", "保安族"),
YUGUR("48", "裕固族"),
GIN("49", "京族"),
TATAR("50", "塔塔尔族"),
DERUNG("51", "独龙族"),
OROQEN("52", "鄂伦春族"),
HEZHEN("53", "赫哲族"),
MONBA("54", "门巴族"),
LHOBA("55", "珞巴族"),
JINO("56", "基诺族"),
OTHER("57", "其他"),
FOREIGN_COUNTRY("58", "外国血统中国籍人士");

private String code;
private String desc;

NationalityEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}

public static String getCodeByDesc(String desc) {
for (NationalityEnum nationalityEnum : values()) {
if (nationalityEnum.getDesc().contains(desc)) {
return nationalityEnum.getCode();
}
}
return OTHER.code;
}

public String getCode() {
return code;
}

public String getDesc() {
return desc;
}

}
7 changes: 4 additions & 3 deletions src/main/java/com/luna/common/command/ProcessUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import com.google.common.collect.ImmutableMap;
import com.luna.common.constant.Constant;
import com.luna.common.constant.StrPoolConstant;
import com.luna.common.dto.constant.ResultCode;
import com.luna.common.exception.BaseException;
import com.luna.common.os.SystemInfoUtil;
Expand Down Expand Up @@ -130,7 +131,7 @@ public static String runCommand(String command) {
if (StringUtils.isBlank(line)) {
break;
}
stringBuilder.append(line).append(Constant.ENTER);
stringBuilder.append(line).append(StrPoolConstant.LF);
}
return stringBuilder.toString();
} catch (IOException e) {
Expand Down Expand Up @@ -169,11 +170,11 @@ public static List<OSProcess> getProcessesByPath(String path) {
* @return
*/
public static String formatPath(String path) {
return path.replace(Constant.BACKSLASH, Constant.SPRIT);
return path.replace(StrPoolConstant.BACKSLASH, StrPoolConstant.SLASH);
}

public static String removeExtension(String filename) {
int idx = filename.lastIndexOf(Constant.DOT);
int idx = filename.lastIndexOf(StrPoolConstant.DOT);
if (idx == -1) {
return filename;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/luna/common/command/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 命令行相关操作
*
* @author [email protected]
* 2021/8/18
*/
package com.luna.common.command;
83 changes: 83 additions & 0 deletions src/main/java/com/luna/common/constant/CharPoolConstant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.luna.common.constant;

/**
* 常用字符常量
*/
public interface CharPoolConstant {
/**
* 字符常量:空格符 {@code ' '}
*/
char SPACE = ' ';
/**
* 字符常量:制表符 {@code '\t'}
*/
char TAB = ' ';
/**
* 字符常量:点 {@code '.'}
*/
char DOT = '.';
/**
* 字符常量:斜杠 {@code '/'}
*/
char SLASH = '/';
/**
* 字符常量:反斜杠 {@code '\\'}
*/
char BACKSLASH = '\\';
/**
* 字符常量:回车符 {@code '\r'}
*/
char CR = '\r';
/**
* 字符常量:换行符 {@code '\n'}
*/
char LF = '\n';
/**
* 字符常量:减号(连接符) {@code '-'}
*/
char DASHED = '-';
/**
* 字符常量:下划线 {@code '_'}
*/
char UNDERLINE = '_';
/**
* 字符常量:逗号 {@code ','}
*/
char COMMA = ',';
/**
* 字符常量:花括号(左) <code>'{'</code>
*/
char DELIM_START = '{';
/**
* 字符常量:花括号(右) <code>'}'</code>
*/
char DELIM_END = '}';
/**
* 字符常量:中括号(左) {@code '['}
*/
char BRACKET_START = '[';
/**
* 字符常量:中括号(右) {@code ']'}
*/
char BRACKET_END = ']';
/**
* 字符常量:双引号 {@code '"'}
*/
char DOUBLE_QUOTES = '"';
/**
* 字符常量:单引号 {@code '\''}
*/
char SINGLE_QUOTE = '\'';
/**
* 字符常量:与 {@code '&'}
*/
char AMP = '&';
/**
* 字符常量:冒号 {@code ':'}
*/
char COLON = ':';
/**
* 字符常量:艾特 {@code '@'}
*/
char AT = '@';
}
21 changes: 0 additions & 21 deletions src/main/java/com/luna/common/constant/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,6 @@
* 2021/7/30
*/
public interface Constant {
String PERCENT = "%";
String UTF8 = "UTF-8";
String COMMA = ",";
String COLON = ":";
String SEMICOLON = ";";
String ENTER = "\n";
String EMPTY = "";
String BLANK = " ";
String MIDDLELINE = "-";
String UNDERLINE = "_";
String DOT = ".";
String NULL = "null";
String PLUS = "+";
String XING = "*";
String MONEY = "¥";
String SPRIT = "/";
String BACKSLASH = "\\";
String QUESTION = "?";

Character MIDDLELINE_CHAR = '-';

/** 0.0 */
String ONE_POINT_ONE = "0.0";
/** 0. */
Expand Down
Loading

0 comments on commit c9c3228

Please sign in to comment.