1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.tools.i18n.LocalizedInput |
4 | |
5 | Copyright 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | package org.apache.derby.iapi.tools.i18n; |
21 | |
22 | import java.io.InputStreamReader; |
23 | import java.io.InputStream; |
24 | import java.io.UnsupportedEncodingException; |
25 | import java.io.IOException; |
26 | |
27 | public class LocalizedInput extends InputStreamReader{ |
28 | private InputStream in; |
29 | public LocalizedInput(InputStream i){ |
30 | super(i); |
31 | this.in = i; |
32 | } |
33 | |
34 | LocalizedInput(InputStream i, String encode) throws UnsupportedEncodingException{ |
35 | super(i,encode); |
36 | this.in = i; |
37 | } |
38 | public boolean isStandardInput(){ |
39 | return (in == System.in); |
40 | } |
41 | public void close() throws IOException { |
42 | if (!isStandardInput()) { |
43 | super.close(); |
44 | } |
45 | } |
46 | |
47 | } |