cn.atomtool.captcha.utils.encoder.EncoderHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atomtool-captcha Show documentation
Show all versions of atomtool-captcha Show documentation
atomTool核心工具包,包括集合、字符串、Bean等工具类
The newest version!
package cn.atomtool.captcha.utils.encoder;
import cn.atomtool.captcha.service.Captcha;
import cn.atomtool.captcha.service.CaptchaService;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.io.OutputStream;
public class EncoderHelper {
public static String getChallangeAndWriteImage(CaptchaService service, String format, OutputStream os) throws IOException {
Captcha captcha = service.getCaptcha();
ImageIO.write(captcha.getImage(), format, os);
return captcha.getChallenge();
}
}