I need to download and save file. I'm trying to use HTTPBuilder because it has simple API and supports cookies. I have written following code:
//create new httpBuilder and set cookies def httpBuilder = ... def file = ... def inputStream = httpBuilder.get(uri: urlData.url, contentType: ContentType.BINARY) FileUtils.copyInputStreamToFile(inputStream) - How can I check that file is correctly downloaded (not only the part of the file)?
- For large files exception
java.lang.OutOfMemoryError: Java heap spaceoccurs on linedef inputStream = httpBuilder.get...How can I solve it? - May be it's not best choise to download files by
HTTPBuilder. What is the best way to download file with cookies support?
httpBuilder.client.execute