@ywitodenasuby

Android. Почему такая конструкция читает только часть документа?

Есть код, который у всех работает, как надо, а у меня читает только часть документа.

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 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;
        }
    }


Приходит:
<!DOCTYPE html><html lang="en-US" prefix="og: http://ogp.me/ns#"><head><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 java class, then you can reuse them to operate different SQLite database and tables. 1. Android SQLite &hellip;" /><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 java class, then you can reuse them to operate different SQLite database and tables. 1. Android SQLite [&hellip;]" /><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=" &raquo; Feed" href="https://www.dev2qa.com/feed/" /><link rel="alternate" type="application/rss+xml" title=" &raquo; Comments Feed" href="https://www.dev2qa.com/comments/feed/" /><link rel="alternate" type="application/rss+xml" title=" &raquo; 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="600 32px 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


Остальное где-то потерялось.
  • Вопрос задан
  • 78 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Satangelus
if(in.ready())
{
String input = in.readLine();
}
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы