All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.ide.spl.ProcessWatchThread Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.ide.spl;

import java.io.InputStream;
import java.util.Scanner;

/**
 * ?ȴ??̣߳????ڽ???Process???ص???Ϣ
 */
public class ProcessWatchThread extends Thread {
	InputStream in;
	boolean over;

	public ProcessWatchThread(InputStream in) {
		this.in = in;
		over = false;
	}

	public void run() {
		if (in == null)
			return;
		Scanner br = null;
		try {
			br = new Scanner(in);
			while (true) {
				if (in == null || over)
					break;
				while (br.hasNextLine()) {
					String tempStream = br.nextLine();
					if (tempStream.trim() == null
							|| tempStream.trim().equals(""))
						continue;
					outputLine(tempStream);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (br != null) {
				br.close();
			}
		}
	}

	protected void outputLine(String line) {
		System.out.println(line);
	}

	public void setOver(boolean over) {
		this.over = over;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy