I am using Apache HttpClient. my code looks like this
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(uri);
HttpResponse response = httpClient.execute(httpGet);
InputStream is = response.getEntity().getContent();
File file = new File("filename.txt");
FileOutputStream os = new FileOutputStream(file);
IOUtils.copy(is,os);
This is going very slowly, like 13 seconds for a 400KB file. After some detailed debugging i found that I am only reading 8-10 bytes at a time from the inputstream. Apache IOUtils.copy already buffers with a buffer size of 4kb, is there any way to make this more performant as I am reading 200 files at a time and this performance is unacceptable. Thanks!!.