streamhandler.java
来自「plugin for eclipse」· Java 代码 · 共 47 行
JAVA
47 行
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 + =
减小字号Ctrl + -
显示快捷键?