1) Changed indentation of (single or double) quoted strings to align on the first...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / util / StreamUtil.java
1 package net.sourceforge.phpdt.internal.ui.util;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.io.OutputStream;
6
7 public class StreamUtil {
8         public static void transferStreams(InputStream source,
9                         OutputStream destination) throws IOException {
10                 try {
11                         byte[] buffer = new byte[8192];
12                         while (true) {
13                                 int bytesRead = source.read(buffer);
14                                 if (bytesRead == -1)
15                                         break;
16                                 destination.write(buffer, 0, bytesRead);
17                         }
18                 } finally {
19                         try {
20                                 source.close();
21                         } catch (IOException e) {
22                         }
23                         try {
24                                 destination.close();
25                         } catch (IOException e) {
26                         }
27                 }
28         }
29 }