KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > transcoder > image > LanguageTest


1 /*
2
3    Copyright 2001-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.transcoder.image;
19
20 import java.util.HashMap JavaDoc;
21 import java.util.Map JavaDoc;
22
23 import org.apache.batik.transcoder.TranscoderInput;
24
25 /**
26  * Test the ImageTranscoder with the KEY_LANGUAGE transcoding hint.
27  *
28  * @author <a HREF="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
29  * @version $Id: LanguageTest.java,v 1.5 2004/08/18 07:17:12 vhardy Exp $
30  */

31 public class LanguageTest extends AbstractImageTranscoderTest {
32
33     /**
34      * Constructs a new <tt>LanguageTest</tt>.
35      */

36     /** The URI of the input image. */
37     protected String JavaDoc inputURI;
38
39     /** The URI of the reference image. */
40     protected String JavaDoc refImageURI;
41
42     /** The preferred language. */
43     protected String JavaDoc language;
44
45     /**
46      * Constructs a new <tt>LanguageTest</tt>.
47      *
48      * @param inputURI the URI of the input image
49      * @param the URI of the reference image
50      * @param language the preferred language
51      */

52     public LanguageTest(String JavaDoc inputURI,
53             String JavaDoc refImageURI,
54             String JavaDoc language) {
55     this.inputURI = inputURI;
56     this.refImageURI = refImageURI;
57     this.language = language;
58     }
59
60     /**
61      * Creates the <tt>TranscoderInput</tt>.
62      */

63     protected TranscoderInput createTranscoderInput() {
64     return new TranscoderInput(resolveURL(inputURI).toString());
65     }
66     
67     /**
68      * Creates a Map that contains additional transcoding hints.
69      */

70     protected Map JavaDoc createTranscodingHints() {
71     Map JavaDoc hints = new HashMap JavaDoc(7);
72     hints.put(ImageTranscoder.KEY_LANGUAGE, language);
73     return hints;
74     }
75
76     /**
77      * Returns the reference image for this test.
78      */

79     protected byte [] getReferenceImageData() {
80     return createBufferedImageData(resolveURL(refImageURI));
81     }
82 }
83
Popular Tags