public class GenerateCodeUtil extends Object
| 构造器和说明 |
|---|
GenerateCodeUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
generateVerifyCode(int verifySize)
使用系统默认字符源生成验证码
|
static String |
generateVerifyCode(int verifySize,
String sources)
使用指定源生成验证码
|
private String |
getMD5Hex(String str) |
private static Color |
getRandColor(int fc,
int bc) |
private static int |
getRandomIntColor() |
private static int[] |
getRandomRgb() |
private String |
getTIMEstr() |
static void |
outputImage(int w,
int h,
File outputFile,
String code)
生成指定验证码图像文件
|
static void |
outputImage(int w,
int h,
OutputStream os,
String code)
输出指定验证码图片流
|
static String |
outputVerifyImage(int w,
int h,
File outputFile,
int verifySize)
生成随机验证码文件,并返回验证码值
|
static String |
outputVerifyImage(int w,
int h,
OutputStream os,
int verifySize)
输出随机验证码图片流,并返回验证码值
|
private static void |
shear(Graphics g,
int w1,
int h1,
Color color) |
private static void |
shearX(Graphics g,
int w1,
int h1,
Color color) |
private static void |
shearY(Graphics g,
int w1,
int h1,
Color color) |
private String |
StrHex(StringBuffer str,
StringBuffer key) |
String |
touchTextCode(String key,
int length)
根据关键字生成验证码
|
public static String generateVerifyCode(int verifySize)
verifySize - 验证码长度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)
throws IOException
w - h - os - code - IOExceptionprivate static Color getRandColor(int fc, int bc)
private static int getRandomIntColor()
private static int[] getRandomRgb()
public String touchTextCode(String key, int length)
key - 关键字length - 验证码长队private String StrHex(StringBuffer str, StringBuffer key)
private String getTIMEstr()
Copyright © 2024. All rights reserved.