private static void copyFileWithoutClosingOutputStream(InputStream stream,OutputStream outStream) throws IOException {
  final byte[] buffer=new byte[CarbonCommonConstants.BYTEBUFFER_SIZE];
  int len;
  try {
    for (; ; ) {
      len=stream.read(buffer);
      if (len == -1) {
        return;
      }
      outStream.write(buffer,0,len);
    }
  }
 catch (  IOException e) {
    throw e;
  }
 finally {
    CarbonUtil.closeStreams(stream);
  }
}

private static void copyFileWithoutClosingOutputStream ( InputStream stream , OutputStream outStream ) throws IOException { final byte [ ] buffer = new byte [ CarbonCommonConstants . BYTEBUFFER_SIZE ] ; int len ; try { for ( ; ; ) { len = stream . read ( buffer ) ; if ( len == - 1 ) { return ; } outStream . write ( buffer , 0 , len ) ; } } catch ( IOException e ) { throw e ; } finally { CarbonUtil . closeStreams ( stream ) ; } }
this method will copy input stream to output stream it will copy file to destination and will not close the outputstream .
