01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.debug.jdi.tests;
11:
12: import java.io.BufferedReader;
13: import java.io.IOException;
14: import java.io.InputStream;
15: import java.io.InputStreamReader;
16:
17: /**
18: * A null console reader that continuously reads from the VM input stream
19: * so that the VM doesn't block when the program writes to the stout.
20: */
21:
22: public class NullConsoleReader extends AbstractReader {
23: private InputStream fInput;
24:
25: /**
26: * Constructor
27: * @param name
28: * @param input
29: */
30: public NullConsoleReader(String name, InputStream input) {
31: super (name);
32: fInput = input;
33: }
34:
35: /**
36: * Continuously reads events that are coming from the event queue.
37: */
38: protected void readerLoop() {
39: java.io.BufferedReader input = new BufferedReader(
40: new InputStreamReader(fInput));
41: try {
42: int read = 0;
43: while (!fIsStopping && read != -1) {
44: read = input.read();
45: }
46: } catch (IOException e) {
47: }
48: }
49: }
|