⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 streamhandler.java

📁 plugin for eclipse
💻 JAVA
字号:
package isis.commons.exec;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * Pumps the data from an input stream to an output stream.
 * @author sallai
 *
 */
public class StreamHandler extends Thread {
	InputStream is;
    OutputStream os;

    StreamHandler(InputStream is) {
        this(is, null);
    }

    StreamHandler(InputStream is, OutputStream os) {
        this.is = is;
        this.os = os;
    }

    public void run() {
   	
    	if(is==null) return;
    	
        try {
            int c;
            while ((c = is.read()) != -1) {
            	if(os!=null) os.write(c);
            }
            if (os!=null) os.flush();
        } catch (IOException ioe) {
            ioe.printStackTrace();
//        } finally {
//            if (!System.out.equals(os) && !System.err.equals(os)) {
//                if (os!=null)
//                    try {
//                        os.close();
//                    } catch (Exception e) {
//                    }
//            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -