Android. Why is this design only reads part of the document?

There is a code which all works as it should, and I have read only part of the document.

private String getHtml(String purl){
 StringBuilder sb = new StringBuilder();
sb.append("");
 String html = "";

 try {
 URL URL = new URL("https://www.dev2qa.com/how-to-write-reusable-code-for-android-sqlite-database/");

 BufferedReader in;
 in = new BufferedReader(
 new the InputStreamReader(
 url.openStream(), "UTF-8"));

 String inputLine;
 while ((inputLine = in.readLine()) != null)
sb.append(inputLine);

in.close();

 html = sb.toString();
 return html;

 } catch (Exception e) {
 return html;
}
 }


Comes:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-97183328-1"></script><script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-97183328-1');</script><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-7563614378817495", enable_page_level_ads: true });</script><meta charset="UTF-8"><title>How To Write Reusable Code For Android SQLite Database</title><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="generator" content="Stargazer 4.0.0"><link rel="canonical" href="https://www.dev2qa.com/how-to-write-reusable-code-for-android-sqlite-database/"><meta property="og:locale" content="en_US"><meta property="og:type" content="article"><meta property="og:title" content="How To Write Reusable Code For Android SQLite Database"><meta property="og:description" content="This example will tell you how to encapsulate android SQLite database operations in the java class, then you can reuse them to operate different SQLite database and tables. 1. Android SQLite ..."><meta property="og:url" content="https://www.dev2qa.com/how-to-write-reusable-code-for-android-sqlite-database/"><meta property="article:tag" content="Android SQLite"><meta property="article:tag" content="Database"><meta property="article:section" content="Android Tutorial"><meta property="article:published_time" content="2018-01-18T07:41:01+00:00"><meta name="twitter:card" content="summary"><meta name="twitter:description" content="This example will tell you how to encapsulate android SQLite database operations in the java class, then you can reuse them to operate different SQLite database and tables. 1. Android SQLite [...]"><meta name="twitter:title" content="How To Write Reusable Code For Android SQLite Database"><meta name="twitter:image" content="http://www.dev2qa.com/wp-content/uploads/2018/01/android-sqlite-database-operations-reusable-java-class.png"><script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Person","url":"https:\/\/www.dev2qa.com\/","sameAs":[],"@id":"#person","name":"song zhao"}</script><link rel="dns-prefetch" href="//fonts.googleapis.com"><link rel="dns-prefetch" href="//s.w.org"><link rel="alternate" type="application/rss+xml" title=" "Feed" href="https://www.dev2qa.com/feed/"><link rel="alternate" type="application/rss+xml" title=" "Comments Feed" href="https://www.dev2qa.com/comments/feed/"><link rel="alternate" type="application/rss+xml" title=" "How To Write Reusable Code For Android SQLite Database Comments Feed" href="https://www.dev2qa.com/how-to-write-reusable-code-for-android-sqlite-database/feed/"><link rel="pingback" href="https://www.dev2qa.com/xmlrpc.php"><script type="text/javascript"> window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.4\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.4\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/www.dev2qa.com\/wp-includes\/js\/wp-emoji-release.min.js"}}; !function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="32px 600 Arial",a){case"flag":return!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b);case"emoji":return b=d([55357,56692,8205,9792,65039],[55357,56692,8203,9792,65039]),!b}return!1}function f(a</code></pre><br><br>
The rest was lost.</script>
June 3rd 19 at 19:40
1 answer
June 3rd 19 at 19:42
if(in.ready())
{
String input = in.readLine();
}
Does not work( - Dario_Mann47 commented on June 3rd 19 at 19:45
,
try this
while(in.hasNextLine())
{
String current = in.nextLine();
}

or so
while(in.ready())
{
 if(in.readLine() != null && !(in.readLine().equals("")) && !(in.readLine().equals(" ")))
{
 string input = in.readLine();
}
}
- cydney.Kling66 commented on June 3rd 19 at 19:48

Find more questions by tags AndroidJava