private static void writeInputStreamToOutputStream(InputStream inputStream,OutputStream outputStream){
  try {
    try {
      final byte[] buffer=new byte[1024];
      int read;
      while ((read=inputStream.read(buffer)) != -1) {
        outputStream.write(buffer,0,read);
      }
      outputStream.flush();
    }
 catch (    final Exception e) {
      e.printStackTrace();
    }
 finally {
      outputStream.close();
      inputStream.close();
    }
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
}

private static void writeInputStreamToOutputStream ( InputStream inputStream , OutputStream outputStream ) { try { try { final byte [ ] buffer = new byte [ 1024 ] ; int read ; while ( ( read = inputStream . read ( buffer ) ) != - 1 ) { outputStream . write ( buffer , 0 , read ) ; } outputStream . flush ( ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; } finally { outputStream . close ( ) ; inputStream . close ( ) ; } } catch ( final Exception e ) { e . printStackTrace ( ) ; } }
write input stream to output stream .
