private void writeToFile(final InputStream input,final File output) throws IOException {
  try (FileWriter writer=new FileWriter(output)){
    BufferedReader reader=new BufferedReader(new InputStreamReader(input));
    String line;
    while ((line=reader.readLine()) != null) {
      writer.write(line);
      writer.write(EOL);
    }
  }
 }

private void writeToFile ( final InputStream input , final File output ) throws IOException { try ( FileWriter writer = new FileWriter ( output ) ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( input ) ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { writer . write ( line ) ; writer . write ( EOL ) ; } } }
write the content of the input stream to the output file .
