+ protected boolean downloadToFile(InputStream inStream, File outputFile)
+ throws IOException
+ {
+ FileOutputStream outStream = new FileOutputStream(outputFile);
+
+ byte[] buffer = new byte[4096];
+ int read = 0;
+ while ((read = inStream.read(buffer)) != -1)
+ {
+ outStream.write(buffer, 0, read);
+ }
+ // Make sure streams are closed
+ try {inStream.close();} catch (Exception e) {}
+ try {outStream.close();} catch (Exception e) {}
+ return true;
+
+ }
+