title: Error reading from input stream
body: <p>I'm trying to make a news reader app based on the Hacker News' API. When I'm trying to make an <code>InputStream</code> to get the InputStream from the connection, but something went worng and I can't really get it.</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      ArrayList&lt;String&gt; newsArrayList;
      ArrayAdapter&lt;String&gt; arrayAdapter;
      ArrayList&lt;String&gt; arrayURLs;
      int numberOfItems;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          newsArrayList = new ArrayList&lt;String&gt;();
          arrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, newsArrayList);
          arrayURLs = new ArrayList&lt;&gt;();
  
          final ListView listView = (ListView) findViewById(R.id.newsList);
          listView.setAdapter(arrayAdapter);
  
          DownloadTask task = new DownloadTask();
  
          try {
              task.execute("https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty").get();
  
              listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
                  @Override
                  public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
                      if(newsArrayList.size() == arrayURLs.size()){
                          Intent intent = new Intent(MainActivity.this, WebActivity.class);
  
                          WebActivity.webView.loadUrl(arrayURLs.get(position));
  
                          startActivity(intent);
                      }
                      return true;
                  }
              });
  
          } catch (InterruptedException e) {
              e.printStackTrace();
          } catch (ExecutionException e) {
              e.printStackTrace();
          }
  
          Log.i("a","a");
  
  
      }
  
  
      public class DownloadTask extends AsyncTask&lt;String, Void, String&gt;{
  
          @Override
          protected String doInBackground(String... urls) {
              String result = "";
              URL url;
              HttpURLConnection connection;
  
              try {
                  url = new URL(urls[0]);
                  connection = (HttpURLConnection) url.openConnection();
  
                  InputStream in = connection.getInputStream();
                  InputStreamReader reader = new InputStreamReader(in);
  
                  int data = reader.read();
  
                  while(data != -1){
  
                      char part = (char) data;
                      result = result + part;
  
                      data = reader.read();
                  }
  
                  JSONArray jsonArray = new JSONArray(result);
  
                  numberOfItems = 20;
                  for (int i = 0; i &lt; numberOfItems; i++ ){
                      String getId = jsonArray.getString(i);
  
                      url = new URL("https://hacker-news.firebaseio.com/v0/item/" + getId + ".json?print=pretty");
                      connection = (HttpURLConnection) url.openConnection();
  
                      in = connection.getInputStream();
                      reader = new InputStreamReader(in);
  
                      data = reader.read();
                      String articleInfo = "";
                      while(data != -1){
  
                          char part = (char) data;
                          articleInfo = articleInfo + part;
  
                          data = reader.read();
                      }
                      JSONObject jsonObject = new JSONObject(articleInfo);
  
                      String articleTitle = jsonObject.getString("title");
                      String articleURL = jsonObject.getString("url");
  
                      arrayURLs.add(articleURL);
  
                      newsArrayList.add(articleTitle);
                      arrayAdapter.notifyDataSetChanged();
                  }
  
  
  
  
                  return result;
  
              } catch (MalformedURLException e) {
                  e.printStackTrace();
              } catch (IOException e) {
                  e.printStackTrace();
              } catch (JSONException e) {
                  e.printStackTrace();
              }
  
              return null;
          }
      }
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code> 12-07 11:03:00.294 2692-7601/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
  12-07 11:03:00.296 2692-7601/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
                                                                                                com.google.android.apps.gsa.shared.speech.a.g: Error reading from input stream
                                                                                                    at com.google.android.apps.gsa.staticplugins.recognizer.i.a.a(SourceFile:342)
                                                                                                    at com.google.android.apps.gsa.staticplugins.recognizer.i.a$1.run(SourceFile:1367)
                                                                                                    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                                                    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                                    at java.lang.Thread.run(Thread.java:761)
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
                                                                                                 Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
                                                                                                    at com.google.android.apps.gsa.speech.audio.Tee.g(SourceFile:2531)
                                                                                                    at com.google.android.apps.gsa.speech.audio.ap.read(SourceFile:555)
                                                                                                    at java.io.InputStream.read(InputStream.java:101)
                                                                                                    at com.google.android.apps.gsa.speech.audio.al.run(SourceFile:362)
                                                                                                    at com.google.android.apps.gsa.speech.audio.ak$1.run(SourceFile:471)
                                                                                                    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
                                                                                                    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:66)
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ax.run(SourceFile:139)
                                                                                                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                                                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                                                    at java.lang.Thread.run(Thread.java:761) 
                                                                                                    at com.google.android.apps.gsa.shared.util.concurrent.a.ad$1.run(SourceFile:85)
  </code></pre>