Source code: org/media/mn8/util/StreamResolver.java
1 /*
2 * $COPYRIGHT$
3 * $Id: StreamResolver.java,v 1.1 2001/05/24 11:13:12 neuro Exp $
4 *
5 * Date Author Changes
6 * May 23 2001 Remus Pereni Created
7 */
8 package org.media.mn8.util;
9
10
11 import java.io.InputStream;
12 import java.io.PrintStream;
13 import java.io.IOException;
14
15
16 /**
17 * Class meant to resolve divers types of input and
18 * output streams. The treams can be speciffied as:
19 * <ul>
20 * <li><b>"System.out", "System.err", "System.in"</b> in which
21 * case the respective streams will be returned.</li>
22 * <li><b>"file://url of file"</b> in which case the a
23 * srem will be created and asociated with that file.</li>
24 * <li><b>"Classname.methodname(parameters)" in which case a new
25 * instance of the class will be created and the methodname with
26 * the parameters will be used to extract the stream</li>
27 * </ul>
28 * @author <a href="mailto:remus@nolimits.ro">Remus Pereni</a>
29 * @version $Revision: 1.1 $ $Date: 2001/05/24 11:13:12 $
30 */
31 public class StreamResolver {
32
33 public static PrintStream resolveOutputStream( String specs ) {
34
35 if ( specs.toLowerCase().equals("system.out") )
36 return System.out;
37
38 if ( specs.toLowerCase().equals("system.err") )
39 return System.err;
40
41 return null;
42 }
43
44
45 public static InputStream resolveInputStream (String specs) {
46 if ( specs.toLowerCase().equals("system.in") )
47 return System.in;
48
49 return null;
50 }
51
52 }