title: scala InputStreamReader Not reading entire data (file)
body: <p>i am trying to hit tally server via scala rest call and save output in file</p>
  
  <p>when i curl same i get around 412K line of output
  but when i hit via scala i get only 411K lines (around 500 lines are missing)</p>
  
  <p>is this because of some buffer size issue</p>
  
  <p>following is my code</p>
  
  <pre><code>    httpConn.setRequestProperty("Content-Length", String.valueOf(b.length))
      httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8")
      httpConn.setRequestMethod("POST")
      httpConn.setDoOutput(true)
      httpConn.setDoInput(true)
      val out = httpConn.getOutputStream
      out.write(b)
      out.close()
      val isr = new InputStreamReader(httpConn.getInputStream)
      val in = new BufferedReader(isr) 
      var temp: String = null
      temp= SaveFile(in)  //pass stream to save into file
  </code></pre>
  
  <p>and file is save via</p>
  
  <pre><code> def SaveFile(a: BufferedReader): String = { 
      val file = new File("OPinWorkspace.xml")
      val bw = new BufferedWriter(new FileWriter(file))
  
  
      Iterator 
      .continually (a.read)
      .takeWhile (-1 !=)
      .foreach (bw.write)
  
  
  return foo
  }
  </code></pre>