01: /*=============================================================================
02: * Copyright Texas Instruments 2000-2003. All Rights Reserved.
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package oscript.util;
20:
21: import java.io.*;
22:
23: import oscript.exceptions.ProgrammingErrorException;
24:
25: /**
26: * Converts an input-stream to abstract-file.
27: *
28: * @author Rob Clark (rob@ti.com)
29: */
30: public class InputStreamFile extends oscript.fs.AbstractAbstractFile {
31: private InputStream is;
32:
33: /**
34: * Class Constructor.
35: *
36: * @param in the input stream
37: * @param path the file name
38: */
39: public InputStreamFile(InputStream is, String path) {
40: super (path, true);
41: this .is = is;
42: }
43:
44: /**
45: * Class Constructor.
46: *
47: * @param in the input reader
48: * @param path the file name
49: */
50: public InputStreamFile(Reader r, String path) {
51: this (new ReaderInputStream(r), path);
52: }
53:
54: /**
55: * Get an input stream to read from this file.
56: *
57: * @return input stream
58: * @throws IOException if <code>canRead</code> returns <code>true</code>
59: * @see #canRead
60: */
61: public InputStream getInputStream() throws IOException {
62: return is;
63: }
64: }
65:
66: /*
67: * Local Variables:
68: * tab-width: 2
69: * indent-tabs-mode: nil
70: * mode: java
71: * c-indentation-style: java
72: * c-basic-offset: 2
73: * eval: (c-set-offset 'substatement-open '0)
74: * eval: (c-set-offset 'case-label '+)
75: * eval: (c-set-offset 'inclass '+)
76: * eval: (c-set-offset 'inline-open '0)
77: * End:
78: */
|