Interface Captcha

All Known Implementing Classes:
AbstractCaptcha, CircleCaptcha, LineCaptcha, ShearCaptcha

public interface Captcha
验证码接口,参考 Hutool 的 Captcha 设计。
Since:
0.1.0
Author:
suretool
  • Method Summary

    Modifier and Type
    Method
    Description
    获取验证码文本。
    获取 data URI(data:image/png;base64,...)
    byte[]
    获取验证码图片字节(PNG 格式)。
    boolean
    verify(String userInputCode)
    校验用户输入(忽略大小写)。
    void
    输出验证码图片(PNG 格式)。
  • Method Details

    • getCode

      String getCode()
      获取验证码文本。
      Returns:
      验证码文本
    • verify

      boolean verify(String userInputCode)
      校验用户输入(忽略大小写)。
      Parameters:
      userInputCode - 用户输入
      Returns:
      是否匹配
    • write

      void write(OutputStream out) throws IOException
      输出验证码图片(PNG 格式)。
      Parameters:
      out - 输出流
      Throws:
      IOException - 输出失败
    • getImageBytes

      byte[] getImageBytes()
      获取验证码图片字节(PNG 格式)。
      Returns:
      图片字节
    • getImageBase64

      String getImageBase64()
      获取 data URI(data:image/png;base64,...),便于直接嵌入页面。
      Returns:
      data URI