title: download json file and store locally on my android device
body: <p>I am doing a rest call and getting a json file from the server by this </p>
  
  <pre><code>HttpGet httpget = new HttpGet("someurl");
  HttpResponse response = httpclient.execute(httpget);
  HttpEntity entity = response.getEntity();
  InputStream source = entity.getContent();
  </code></pre>
  
  <p>now i want to store this into a local file I am using FileOutputStream to do this but the problem is how to effectively convert the inputstream to outputstream if i am using something like this </p>
  
  <pre><code>FileOutputStream fos = openFileOutput(filename,Context.MODE_PRIVATE);
  
              int nextChar;
              while ((nextChar = source.read()) != -1) {
                  fos.write((char) nextChar);
                  System.out.println((char) nextChar);
                  fos.flush();
              }
  </code></pre>
  
  <p>it is storing very slow the file which i am getting is upto 100kb is there any other faster method or any other way which i can use to store the json file in my device?</p>
  
  <p>My applications uses this json heavily and i don't want to call the REST each time. </p>
  
  <p>thanks
  Pranay</p>