1 /*
2 Copyright (C) 2007 Richard Gomes
3
4 LaTeXTaglet is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the license for more details.
12
13 You should have received a copy of the GNU Lesser Public License
14 along with LaTeXTaglet; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 package net.sf.latextaglet.internal;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.io.OutputStream;
23
24 /**
25 * Processing of Streams related to a call of Runtime.exec
26 *
27 * @author Richard Gomes
28 */
29 public class StreamHandler extends Thread {
30 InputStream is;
31 OutputStream os;
32
33 StreamHandler(InputStream is, OutputStream os) {
34 this.is = is;
35 this.os = os;
36 }
37
38 public void run() {
39 try {
40 int c;
41
42 while ((c = is.read()) != -1) {
43 os.write(c);
44 os.flush();
45 }
46 } catch (IOException e) {
47 }
48 }
49
50 }