code: private static void copyStreamWithoutClosing( InputStream in, OutputStream out ) throws IOException
      {
          final int bufferSize = 4096;
          byte[] b = new byte[ bufferSize ];
          int n;
          while ( ( n = in.read( b ) ) != - 1 )
          {
              out.write( b, 0, n );
          }
      }
docs: Copies an input stream into an output stream but does not close the streams.
  
  @param in  the input stream
  @param out the output stream
  @throws IOException if the stream cannot be copied