While i am running my code i'm getting error as "java.io.IOException:Attempted read from closed stream"
In my response i'm getting a PDF , i just want to read it and store it in my local.
My Code:
HttpResponse secondResponse = aHttpClient.execute(secondPost);
InputStream inputStream = secondResponse.getEntity().getContent();
FileOutputStream fileOutputStream = new FileOutputStream(new File("Result.pdf"));
int read = 0;
byte[] buffer = new byte[32768];
while ((read = inputStream.read(buffer)) > 0) {
fileOutputStream.write(buffer, 0, read);
}