KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > tools > Tool


1 /*
2  * @(#)Tool.java 1.8 06/09/25
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.tools;
9
10 import java.util.Set JavaDoc;
11 import java.io.InputStream JavaDoc;
12 import java.io.OutputStream JavaDoc;
13 import javax.lang.model.SourceVersion;
14
15 /**
16  * Common interface for tools that can be invoked from a program.
17  * A tool is traditionally a command line program such as a compiler.
18  * The set of tools available with a platform is defined by the
19  * vendor.
20  *
21  * <p>Tools can be located using {@link
22  * java.util.ServiceLoader#load(Class)}.
23  *
24  * @author Neal M Gafter
25  * @author Peter von der Ah&eacute;
26  * @author Jonathan Gibbons
27  * @since 1.6
28  */

29 public interface Tool {
30
31     /**
32      * Run the tool with the given I/O channels and arguments. By
33      * convention a tool returns 0 for success and nonzero for errors.
34      * Any diagnostics generated will be written to either {@code out}
35      * or {@code err} in some unspecified format.
36      *
37      * @param in "standard" input; use System.in if null
38      * @param out "standard" output; use System.out if null
39      * @param err "standard" error; use System.err if null
40      * @param arguments arguments to pass to the tool
41      * @return 0 for success; nonzero otherwise
42      * @throws NullPointerException if the array of arguments contains
43      * any {@code null} elements.
44      */

45     int run(InputStream JavaDoc in, OutputStream JavaDoc out, OutputStream JavaDoc err, String JavaDoc... arguments);
46
47     /**
48      * Gets the source versions of the Java&trade; programming language
49      * supported by this tool.
50      * @return a set of supported source versions
51      */

52     Set JavaDoc<SourceVersion> getSourceVersions();
53
54 }
55
Popular Tags