01: package com.sun.portal.app.filesharing.util;
02:
03: import java.io.InputStream;
04: import java.io.OutputStream;
05: import java.io.IOException;
06:
07: /**
08: * @author Alejandro Abdelnur
09: */
10: public class IOUtils {
11:
12: private static final int BUFFER_SIZE = 4096;
13:
14: public static void copyStream(InputStream is, OutputStream os)
15: throws IOException {
16: byte[] buffer = new byte[BUFFER_SIZE];
17: int bytesRead = is.read(buffer, 0, BUFFER_SIZE);
18: while (bytesRead > -1) {
19: os.write(buffer, 0, bytesRead);
20: bytesRead = is.read(buffer, 0, BUFFER_SIZE);
21: }
22: }
23:
24: }
|