public class VerifyCodeTools extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
VERIFY_CODES |
| Constructor and Description |
|---|
VerifyCodeTools() |
| Modifier and Type | Method and Description |
|---|---|
static CaptchaCodeResult |
generateLetterNumVerifyCode(int verifySize)
生成字母数字验证码
|
static CaptchaCodeResult |
generateMathAddVerifyCode(int startInt,
int endInt)
生成范围内的加法验证码 (边界都包括)
|
static String |
generateVerifyCode(int verifySize)
使用系统默认字符源生成验证码
|
static String |
generateVerifyCode(int verifySize,
String sources)
使用指定源生成验证码
|
static void |
outputImage(int w,
int h,
File outputFile,
String code)
生成指定验证码图像文件
|
static void |
outputImage(int w,
int h,
OutputStream os,
String code)
输出指定验证码图片流
|
static void |
outputImage(int w,
int h,
OutputStream os,
String code,
boolean isRotate) |
static String |
outputVerifyImage(int w,
int h,
File outputFile,
int verifySize)
生成随机验证码文件,并返回验证码值
|
static String |
outputVerifyImage(int w,
int h,
OutputStream os,
int verifySize)
输出随机验证码图片流,并返回验证码值
|
public static final String VERIFY_CODES
public static String generateVerifyCode(int verifySize)
verifySize - 验证码长度public static CaptchaCodeResult generateLetterNumVerifyCode(int verifySize)
verifySize - 验证码长度public static CaptchaCodeResult generateMathAddVerifyCode(int startInt, int endInt)
startInt - 开始 (大于0)endInt - 结束 (大于0)public static String generateVerifyCode(int verifySize, String sources)
verifySize - 验证码长度sources - 验证码字符源public static String outputVerifyImage(int w, int h, File outputFile, int verifySize) throws IOException
w - h - outputFile - verifySize - IOExceptionpublic static String outputVerifyImage(int w, int h, OutputStream os, int verifySize) throws IOException
w - h - os - verifySize - IOExceptionpublic static void outputImage(int w,
int h,
File outputFile,
String code)
throws IOException
w - h - outputFile - code - IOExceptionpublic static void outputImage(int w,
int h,
OutputStream os,
String code,
boolean isRotate)
throws IOException
IOExceptionpublic static void outputImage(int w,
int h,
OutputStream os,
String code)
throws IOException
w - h - os - code - IOExceptionCopyright © 2021. All rights reserved.