1
2
3
4
5
6
7 package com.octo.captcha.component.sound.wordtosound;
8
9 import com.octo.captcha.CaptchaException;
10
11 import javax.sound.sampled.AudioInputStream;
12 import java.util.Locale;
13
14 /***
15 * <p/>
16 * Provides methods to tranform a word to a sound </p>.
17 *
18 * @author Gandin Mathieu
19 * @author Doumas Benoit
20 * @version 1.1
21 */
22 public interface WordToSound {
23 /***
24 * @deprecated misspelled, use {@link #getMaxAcceptedWordLength()} instead
25 * @return the max word lenght accepted by this word2image service
26 */
27 int getMaxAcceptedWordLenght();
28
29 /***
30 * @deprecated misspelled, use {@link #getMinAcceptedWordLength()} instead
31 * @return the min word lenght accepted by this word2image service
32 */
33 int getMinAcceptedWordLenght();
34
35
36 /***
37 * @return the max word length accepted by this word2image service
38 */
39 int getMaxAcceptedWordLength();
40
41 /***
42 * @return the min word length accepted by this word2image service
43 */
44 int getMinAcceptedWordLength();
45
46 /***
47 * Main method for this service Return a sound with the specified word
48 *
49 * @param word The word to tranform into sound
50 *
51 * @return the generated sound
52 *
53 * @throws com.octo.captcha.CaptchaException
54 * if word is invalid or an exception occurs during the sound generation
55 */
56 AudioInputStream getSound(String word) throws CaptchaException;
57
58 /***
59 * Main method for this service Return a sound with the specified word and Locale, depending on the local a sound is
60 * not the same. This is a big difference with an image.
61 *
62 * @param word The word to tranform into sound
63 * @param locale Locale for the sound
64 *
65 * @return the generated sound
66 *
67 * @throws com.octo.captcha.CaptchaException
68 * if word is invalid or an exception occurs during the sound generation
69 */
70 AudioInputStream getSound(String word, Locale locale) throws CaptchaException;
71 }