做在线备份时,输出做一个修改,动态把输出内容传到浏览器页面上去。
- import java.io.InputStream;
- import java.io.InputStreamReader;
- class StreamGobbler extends Thread {
- InputStream is;
- String type;
- StreamGobbler(InputStream is, String type) {
- this.is = is;
- this.type = type;
- }
- public void run() {
- try {
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line=null;
- while ( (line = br.readLine()) != null)
- System.out.println(type + ">" + line);
- } catch (IOException ioe) {
- ioe.printStackTrace();
- }
- }
- }
- public class Test {
- public static void main(String args[]) {
- args = new String[1];
- args[0]="exp zcgl/zcgl@db190 file=d:/test.dmp";
- if (args.length