diff --git a/README.md b/README.md
index 99b0691..3c8de05 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# EasyCaptcha
-![JitPack](https://img.shields.io/jitpack/v/whvcse/EasyCaptcha.svg?style=flat-square)
+![MavenCentral](https://img.shields.io/maven-central/v/com.github.whvcse/easy-captcha)
![Hex.pm](https://img.shields.io/hexpm/l/plug.svg?style=flat-square)
@@ -53,52 +53,33 @@
## 3.导入项目
### 3.1.gradle方式的引入
-需要先在project的build.gradle中添加:
-```text
-allprojects {
- repositories {
- maven { url 'https://jitpack.io' }
- }
-}
-```
-在项目的build.gradle中添加
```text
dependencies {
- compile 'com.github.whvcse:EasyCaptcha:1.6.2'
+ compile 'com.github.whvcse:easy-captcha:1.6.2'
}
```
### 3.2.maven方式引入
-在你的pom.xml中添加如下代码:
```xml
-
-
-
- jitpack.io
- https://jitpack.io
-
-
-
-
-
- com.github.whvcse
- EasyCaptcha
- 1.6.2
-
-
-
+
+
+ com.github.whvcse
+ easy-captcha
+ 1.6.2
+
+
```
### 3.3.jar包下载
-[EasyCaptcha-1.6.2.jar](https://gitee.com/whvse/EasyCaptcha/releases)
+[easy-captcha-1.6.2.jar](https://gitee.com/whvse/EasyCaptcha/releases)
maven导入jar包,在项目根目录创建`libs`文件夹,然后pom.xml添加如下:
```
com.github.whvcse
- EasyCaptcha
+ easy-captcha
1.6.1
- ${basedir}/libs/EasyCaptcha-1.6.2.jar
+ ${basedir}/libs/easy-captcha-1.6.2.jar
```
diff --git a/pom.xml b/pom.xml
index 34b173f..cd781cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,16 +2,52 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.wf
+ com.github.whvcse
easy-captcha
- 1.6.2-RELEASE
+ 1.6.2
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 8
+
+
+
+
jar
EasyCaptcha
- Java图形验证码,支持gif验证码、中文验证码,适用于Java Web、JavaSE项目。
+ Java web graphics verification code, support gif verification code.
https://github.com/whvcse/EasyCaptcha
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+
+ whvcse
+ whvcse@foxmail.com
+
+
+
+ scm:git@github.com:whvcse/EasyCaptcha.git
+ scm:git@github.com:whvcse/EasyCaptcha.git
+ https://github.com/whvcse/EasyCaptcha
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
@@ -28,28 +64,65 @@
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 6
- UTF-8
-
-
-
-
-
-
-
- rdc-releases
- https://repo.rdc.aliyun.com/repository/70786-release-exL3mB/
-
-
- rdc-snapshots
- https://repo.rdc.aliyun.com/repository/70786-snapshot-Y0tgOa/
-
-
+
+
+ release
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.2.1
+
+
+ package
+
+ jar-no-fork
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.9.1
+
+
+ package
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.5
+
+
+ verify
+
+ sign
+
+
+
+
+
+
+
+
+ oss
+ https://oss.sonatype.org/content/repositories/snapshots/
+
+
+ oss
+ https://oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/wf/captcha/base/Captcha.java b/src/main/java/com/wf/captcha/base/Captcha.java
index 9ca2d43..e38e4d4 100644
--- a/src/main/java/com/wf/captcha/base/Captcha.java
+++ b/src/main/java/com/wf/captcha/base/Captcha.java
@@ -1,14 +1,12 @@
package com.wf.captcha.base;
-import sun.misc.BASE64Encoder;
-
import java.awt.*;
import java.awt.geom.CubicCurve2D;
import java.awt.geom.QuadCurve2D;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Base64;
/**
* 验证码抽象类
@@ -111,18 +109,23 @@ public abstract class Captcha extends Randoms {
*/
public abstract boolean out(OutputStream os);
+ /**
+ * 输出base64编码
+ *
+ * @return base64编码字符串
+ */
public abstract String toBase64();
/**
* 输出base64编码
*
* @param type 编码头
- * @return
+ * @return base64编码字符串
*/
public String toBase64(String type) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
out(outputStream);
- return type + new BASE64Encoder().encode(outputStream.toByteArray());
+ return type + Base64.getEncoder().encodeToString(outputStream.toByteArray());
}
/**