[izpack-changes] r1673 - izpack-src/trunk/src/lib/com/izforge/izpack/compiler
noreply at berlios.de
noreply at berlios.de
Wed Jan 3 09:49:14 CET 2007
Author: dreil
Date: 2007-01-03 09:49:13 +0100 (Wed, 03 Jan 2007)
New Revision: 1673
Added:
izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackagerHelper.java
Log:
Added missing PackagerHelper class.
Added: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackagerHelper.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackagerHelper.java 2007-01-02 14:40:04 UTC (rev 1672)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/PackagerHelper.java 2007-01-03 08:49:13 UTC (rev 1673)
@@ -0,0 +1,33 @@
+package com.izforge.izpack.compiler;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Helper class for packager classes
+ * @author Dennis Reil, <Dennis.Reil at reddot.de>
+ */
+public class PackagerHelper
+{
+ /**
+ * Copies all the data from the specified input stream to the specified output stream.
+ *
+ * @param in the input stream to read
+ * @param out the output stream to write
+ * @return the total number of bytes copied
+ * @exception IOException if an I/O error occurs
+ */
+ public static long copyStream(InputStream in, OutputStream out) throws IOException
+ {
+ byte[] buffer = new byte[5120];
+ long bytesCopied = 0;
+ int bytesInBuffer;
+ while ((bytesInBuffer = in.read(buffer)) != -1)
+ {
+ out.write(buffer, 0, bytesInBuffer);
+ bytesCopied += bytesInBuffer;
+ }
+ return bytesCopied;
+ }
+}
More information about the izpack-changes
mailing list