source: trunk/modelicaml/org.openmodelica.modelicaml.gen.modelica/src/org/modelica/StreamReaderThread.java @ 889

Last change on this file since 889 was 844, checked in by wschamai, 13 years ago
  • Doc. header update
  • Modelica <<Import>> stereotype handling
File size: 2.5 KB
Line 
1/*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL).
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
13 * OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
14 *
15 * The OpenModelica software and the Open Source Modelica
16 * Consortium (OSMC) Public License (OSMC-PL) are obtained
17 * from OSMC, either from the above address,
18 * from the URLs: http://www.ida.liu.se/projects/OpenModelica or 
19 * http://www.openmodelica.org, and in the OpenModelica distribution.
20 * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
21 *
22 * This program is distributed WITHOUT ANY WARRANTY; without
23 * even the implied warranty of  MERCHANTABILITY or FITNESS
24 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
25 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
26 *
27 * See the full OSMC Public License conditions for more details.
28 *
29 * Main author: Wladimir Schamai, EADS Innovation Works / Linköping University, 2009-now
30 *
31 * Contributors:
32 *   Uwe Pohlmann, University of Paderborn 2009-2010, contribution to the Modelica code generation for state machine behavior, contribution to Papyrus GUI adoptations
33 *   Parham Vasaiely, EADS Innovation Works / Hamburg University of Applied Sciences 2009-2011, implementation of simulation plugins
34 */
35package org.modelica;
36
37import java.io.InputStream;
38import java.io.InputStreamReader;
39import java.io.PrintStream;
40
41// TODO: Auto-generated Javadoc
42/**
43 * The Class StreamReaderThread.
44 */
45public class StreamReaderThread extends Thread
46{
47   
48    /** The m out. */
49    PrintStream mOut;
50   
51    /** The m in. */
52    InputStreamReader mIn;
53
54    /**
55     * Instantiates a new stream reader thread.
56     *
57     * @param in
58     *            the in
59     * @param out
60     *            the out
61     */
62    public StreamReaderThread(InputStream in, PrintStream out)
63    {
64        mOut=out;
65        mIn=new InputStreamReader(in);
66    }
67
68    /* (non-Javadoc)
69     * @see java.lang.Thread#run()
70     */
71    public void run()
72    {
73        int ch;
74        try 
75        {
76            while(-1 != (ch=mIn.read()))
77            {
78                mOut.append((char)ch);
79                mOut.flush();
80            }
81        }
82        catch (Exception e)
83        {
84            mOut.append("\nRead error:"+e.getMessage());
85        }
86    }
87}
Note: See TracBrowser for help on using the repository browser.