CommonUtil/README.md

82 lines
4.2 KiB
Markdown
Raw Normal View History

2019-07-26 15:12:03 +08:00
# CommonUtil
2019-11-25 17:08:32 +08:00
* <b>Desc: A common utils jar for using redis elasticsearch Rest and file even more these.</b>
2019-07-26 16:59:56 +08:00
2019-11-21 16:10:44 +08:00
## Download
2019-11-22 16:39:00 +08:00
[CommonUtil.jar](https://github.com/carolcoral/CommonUtil/releases/download/1.0.1/CommonUtil-1.0.1.jar)
2019-11-21 16:24:32 +08:00
2019-11-22 16:39:00 +08:00
[CommonUtil-javadoc.jar](https://github.com/carolcoral/CommonUtil/releases/download/1.0.1/CommonUtil-1.0.1-javadoc.jar)
2019-11-21 16:24:32 +08:00
2019-11-22 16:39:00 +08:00
[CommonUtil-sources.jar](https://github.com/carolcoral/CommonUtil/releases/download/1.0.1/CommonUtil-1.0.1-sources.jar)
2019-11-21 16:10:44 +08:00
2019-12-27 17:21:14 +08:00
## [WIKI](https://github.com/carolcoral/CommonUtil/wiki)
## Log
2020-07-21 11:20:47 +08:00
> `2020年7月21日 11:20:14` fix some expire bug from [RedisUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/RedisUtil.java).
> `2020年7月20日 14:17:00` New date function for format date by The date-format [DateUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/DateUtil.java).For example like this:
2020-07-20 14:18:22 +08:00
```java
public static void main(String[] args) {
List<String> date_list = Arrays.asList(
"YYYY",
"YYYY-MM",
"YYYY-MM-dd",
"YYYY-MM-dd HH",
"YYYY-MM-dd HH:mm",
"YYYY-MM-dd HH:mm:ss"
);
int parseInt = -1;
for (String date_format : date_list) {
System.out.println("current date_format is: "+date_format);
String formatDateByReg = formatDateByReg(date_format, parseInt);
System.out.println("current format result is:"+formatDateByReg);
}
}
current date_format is: YYYY
current format result is:2019
current date_format is: YYYY-MM
current format result is:2020-06
current date_format is: YYYY-MM-dd
current format result is:2020-07-19
current date_format is: YYYY-MM-dd HH
current format result is:2020-07-20 13
current date_format is: YYYY-MM-dd HH:mm
current format result is:2020-07-20 14:14
current date_format is: YYYY-MM-dd HH:mm:ss
current format result is:2020-07-20 14:15:08
```
2019-12-27 17:21:14 +08:00
2019-12-27 17:22:45 +08:00
> `2019年12月27日 17:20:34` Demo to show how to operation Protobuf in java.[Java中使用ProtoBuf数据](https://github.com/carolcoral/CommonUtil/wiki/Java中使用ProtoBuf数据)
2019-12-27 17:21:14 +08:00
2019-12-11 16:21:39 +08:00
> `2019-12-05 14:33:23` New class for remotely connect to the server and execute the script.[SSH2Util](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/SSH2Util.java)
2019-07-26 16:59:56 +08:00
## How to use
### Import it in your pom
2019-11-21 16:10:44 +08:00
#### Import jar into your maven
```shell
mvn install:install-file -Dfile=<path-to-file> -DgroupId=site.cnkj -DartifactId=CommonUtil -Dversion=1.0 -Dpackaging=jar
```
2019-11-21 16:24:32 +08:00
> Note:<path-to-file> is your local jar of full path.
2019-11-21 16:10:44 +08:00
> For example:
```shell
mvn install:install-file -Dfile=/User/carol/Desktop/CommonUtil-1.0.jar -DgroupId=site.cnkj -DartifactId=CommonUtil -Dversion=1.0 -Dpackaging=jar
```
#### Import dependency into your pom.xml
```yaml
<dependency>
<groupId>site.cnkj</groupId>
<artifactId>CommonUtil</artifactId>
<version>1.0</version>
</dependency>
2019-07-26 16:59:56 +08:00
```
## Use in project
2019-12-11 16:41:21 +08:00
2019-12-11 16:40:57 +08:00
||||||
2019-12-11 16:41:21 +08:00
|:---|:--|:--|:--|:--|
2019-12-11 16:39:53 +08:00
|[RedisUtil](https://github.com/carolcoral/CommonUtil/wiki/RedisUtil)|[ElasticSearch](https://github.com/carolcoral/CommonUtil/wiki/ElasticSearch)|[RestTemplateUtil](https://github.com/carolcoral/CommonUtil/wiki/RestTemplateUtil)|[MongodbUtil](https://github.com/carolcoral/CommonUtil/wiki/MongodbUtil)|[Thread Pool](https://github.com/carolcoral/CommonUtil/wiki/Thread-Pool)|
|[SSH2Util](https://github.com/carolcoral/CommonUtil/wiki/SSH2Util)|[DateUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/DateUtil.java)|[FileEncryptDecrypt](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/FileEncryptDecrypt.java)|[FileUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/FileUtil.java)|
|[GracefulShutdown](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/GracefulShutdown.java)|[HttpCommonUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/HttpCommonUtil.java)|[KafkaUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/KafkaUtil.java)|[LoggerUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/LoggerUtil.java)|[StringUtil](https://github.com/carolcoral/CommonUtil/blob/master/src/main/java/site/cnkj/utils/StringUtil.java)|