Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7873869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:38:23+00:00 2026-06-03T02:38:23+00:00

I have to read an html as a text file and I have implemented

  • 0

I have to read an html as a text file and I have implemented two different methods as described on SO threads. I clean the html leaving just the body content to put it into DOM with document.write(string) with both methods, but it only works if I use Bufferedreader.readLine() (appending a stringBuilder in a loop). In fact, if I print the stringBuilder.toString() in the Logcat window I see that when BufferedReader.readLine() is used the stringBuilder is displayed on a single line in the Logcat window, while with InputStreamReader.read(charArray,0,(int)numBytes) it is displayed multi-line (I am using a real device). Maybe this can be related and suggest which is the issue. My question is : how have I to clean or process that char Array read by read(charArray,0,(int)numBytes) to be the same of the stringBuilder appended in the readLine() loop?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:38:25+00:00Added an answer on June 3, 2026 at 2:38 am

    The BufferedReader.readLine() method reads till the end of the line and returns the value excluding the newline character. Hence when you append it to a StringBuffer everything gets appended to a single line. However, in the case of InputStreamReader.read, the newline character is also included, causing the string to be displayed in multiple lines.

    To make the behavior similar, you will have to skip newline character while using InputStreamReader.read.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web page with a read-only text box which shows some HTML
I have an HTML page with several iframes, each pointing to a text file
I have a batch file running which spits out a text/html file. The batch
I have written a program in Java to read in a text file of
I have code which uses the StreamReader to read HTML from a file, then
In Android project's strings.xml file i have following html text <?xml version=1.0 encoding=utf-8?> <resources>
I have a text file with html: Blah, blah, blah some text is here.
I have read the documentation ( http://dev.mysql.com/doc/refman/5.1/en/partitioning.html ), but I would like, in your
I have read this in order to compile NH spatial for Nhibernate 3.1 http://build-failed.blogspot.it/2012/02/nhibernate-spatial-part-2.html
I have a directory with several .html files. Would like to read the list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.