01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */package com.tc.util.io;
04:
05: import com.tc.exception.TCRuntimeException;
06:
07: import java.io.BufferedInputStream;
08: import java.io.BufferedOutputStream;
09: import java.io.InputStream;
10: import java.io.OutputStream;
11:
12: public class StreamHandler implements Runnable {
13: InputStream in;
14: OutputStream out;
15:
16: public StreamHandler(InputStream in, OutputStream out) {
17: this .in = in;
18: this .out = out;
19: }
20:
21: public void run() {
22: BufferedInputStream bin = new BufferedInputStream(in);
23: BufferedOutputStream bout = new BufferedOutputStream(out);
24: int i;
25: try {
26: while ((i = bin.read()) != -1) {
27: bout.write(i);
28: }
29: bout.flush();
30: } catch (Exception e) {
31: throw new TCRuntimeException(e);
32: }
33: }
34: }
|