code: public static int write(InputStream is, File f) {
          try {
              return copy(is, new BufferedOutputStream(new FileOutputStream(f)));
          } catch (FileNotFoundException e) {
              throw E.ioException(e);
          }
      }
docs: Read from inputstream and write into file.
  @param is
  the inputstream
  @param f
  the file
  @return
  the number of bytes written to the file