View Javadoc

1   package org.lcsim.conditions;
2   
3   import java.io.IOException;
4   import java.io.InputStream;
5   import java.io.InputStreamReader;
6   import java.io.Reader;
7   
8   /**
9    * 
10   * @author Tony Johnson
11   */
12  class RawConditionsImplementation extends ConditionsImplementation implements RawConditions {
13      /** Creates a new instance of RawConditionsImplementation */
14      RawConditionsImplementation(ConditionsManagerImplementation manager, String name) {
15          super(manager, name);
16      }
17  
18      public InputStream getInputStream() throws IOException {
19          String type;
20          String name = getName();
21          int pos = name.lastIndexOf('.');
22          if (pos < 0)
23              type = "ini";
24          else {
25              type = name.substring(pos + 1);
26              name = name.substring(0, pos);
27          }
28          return getManager().open(name, type);
29      }
30  
31      public Reader getReader() throws IOException {
32          return new InputStreamReader(getInputStream());
33      }
34  }