src/main/java/org/jboss/util/stream/Streams.java
/**
    * Copy all of the bytes from the input stream to the output stream.
    *
    * @param input   Stream to read bytes from.
    * @param output  Stream to write bytes to.
    * @param buffer  The buffer to use while copying.
    * @return        The total number of bytes copied.
    *
    * @throws IOException  Failed to copy bytes.
    */
Copy all of the bytes from the input stream to the output stream.
@param input   Stream to read bytes from.
@param output  Stream to write bytes to.
@param buffer  The buffer to use while copying.
@return        The total number of bytes copied.

@throws IOException  Failed to copy bytes.
Copy all of the bytes from the input stream to the output stream . @param input Stream to read bytes from . @param output Stream to write bytes to . @param buffer The buffer to use while copying . @return The total number of bytes copied . @throws IOException Failed to copy bytes .
public static long copy(final InputStream input, 
                           final OutputStream output, 
                           final byte buffer[])
      throws IOException
   {
      long total = 0;
      int read;
      boolean trace = log.isTraceEnabled();
      if (trace) {
         log.trace("copying " + input + " to " + output + " with buffer size: " + buffer.length);
      }
      while ((read = input.read(buffer)) != -1) {
         output.write(buffer, 0, read);
         total += read;
         if (trace) {
            log.trace("bytes read: " + read + "; total bytes read: " + total);
         }
      }
      return total;
   }
public static long copy ( final InputStream input , final OutputStream output , final byte buffer [ ] ) throws IOException { long total = 0 ; int read ; boolean trace = log . isTraceEnabled ( ) ; if ( trace ) { log . trace ( "copying " + input + " to " + output + " with buffer size: " + buffer . length ) ; } while ( ( read = input . read ( buffer ) ) != - 1 ) { output . write ( buffer , 0 , read ) ; total += read ; if ( trace ) { log . trace ( "bytes read: " + read + "; total bytes read: " + total ) ; } } return total ; }
Copy all of the bytes from the input stream to the output stream.
Copy all of the bytes from the input stream to the output stream .