Simplified parsing for double quoted strings
[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, OutputStream destination) throws IOException {
9     try {
10       byte[] buffer = new byte[8192];
11       while (true) {
12         int bytesRead = source.read(buffer);
13         if (bytesRead == -1)
14           break;
15         destination.write(buffer, 0, bytesRead);
16       }
17     } finally {
18       try {
19         source.close();
20       } catch (IOException e) {
21       }
22       try {
23         destination.close();
24       } catch (IOException e) {
25       }
26     }
27   }
28 }