1
2
3
4
5
6
7 package com.octo.captcha.sound.speller;
8
9 import com.octo.captcha.sound.SoundCaptcha;
10
11 import javax.sound.sampled.AudioInputStream;
12
13 /***
14 * <p>SoundCaptcha with spelling</p>
15 *
16 * @author Benoit Doumas
17 * @version 1.0
18 */
19 public class SpellerSound extends SoundCaptcha {
20
21 private String response;
22
23 public SpellerSound(String thequestion,
24 AudioInputStream thechallenge, String theresponse) {
25 super(thequestion, thechallenge);
26 this.response = theresponse;
27 }
28
29 public Boolean validateResponse(Object theresponse) {
30 if ((theresponse != null) && (theresponse instanceof String)) {
31 return this.validateResponse((String) theresponse);
32 } else {
33 return Boolean.FALSE;
34 }
35 }
36
37 public Boolean validateResponse(String theresponse) {
38 return Boolean.valueOf(this.response.equalsIgnoreCase(theresponse));
39 }
40
41 }