Skip to main content
summaryrefslogblamecommitdiffstats
blob: bc647f477310124162375f98132e405c919fd8e4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                                                                
                                                       
                                                                   
                                                                        
                                                           
                                            
  



                                                                                 
 

                 
                                        





                                            
 
                                
 




                                                                                 
 
                 








                                                                     

                                                                                                           

                 
 






                                             
 
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.help.internal.browser;

import java.io.*;

import org.eclipse.help.internal.base.*;

/**
 * Used to receive output from processes
 */
public class StreamConsumer extends Thread {
	BufferedReader bReader;

	private String lastLine;

	public StreamConsumer(InputStream inputStream) {
		super();
		setDaemon(true);
		bReader = new BufferedReader(new InputStreamReader(inputStream));
	}

	@Override
	public void run() {
		try {
			String line;
			while (null != (line = bReader.readLine())) {
				lastLine = line;
				BrowserLog.log(line);
			}
			bReader.close();
		} catch (IOException ioe) {
			HelpBasePlugin.logError(
					"Exception occurred reading from web browser.", ioe); //$NON-NLS-1$
		}
	}

	/**
	 * @return last line obtained or null
	 */
	public String getLastLine() {
		return lastLine;
	}

}

Back to the top