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

  • Home
  • SEARCH
  • 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 7819831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:05:14+00:00 2026-06-02T07:05:14+00:00

If I read a file until it hits a null line and want to

  • 0

If I read a file until it hits a null line and want to create a somewhat accurate JProgressBar for when the reading will be finished, how would I do this?

The reason I ask is because some files are read within 200ms where as others take between 2500ms and 10000ms.

I’m doing something simple for reading the file

boolean completed

while(!completed) {
    //read file
    if(reader == null) {
        completed = false;
    } 
}

So is there a way to make a progress bar accurate for a situation like this? (by the way, the size of the file doesn’t necessarily mean it will take less time to read in this case)

  • 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-02T07:05:15+00:00Added an answer on June 2, 2026 at 7:05 am

    Use the size of the file — it’s your best measure.

    What you display has to have meaning that the users can understand. That’s the most important part. If the progress bar means the percent of the file that has been processed, that’s very easy to understand, easy to quantify, and easy to calculate and display. This makes your progress bar transparent, and that is what’s important.

    Think about how this is to be viewed by users. You don’t need to program some sort of predictive intelligence because the users have brains and they can draw their own conclusions. So if they see the progress bar run fast for the first half and then slow down, they know that the it’s processed half of the file, but the second half is taking longer. That’s all they need to know! They can draw their own conclusion that since the progress bar slowed down, that it may take longer to finish the file than the time indicated in the first half.

    In fact, the users may already know something about the file being processed. For this particular file, they may know that the useful (or long-processing) data is all in the second half. So when they see the progress bar slow down, it is expected to them. This gives the transparency needed for the users to know that the software is working like it should, and they can draw their own conclusions about how long they need to wait.

    Of course, it could also still be useful to show a generic estimation “25% of the file processed in 3 seconds, so we estimate an additional 9 seconds to completion.” This is also a very general basic equation that is transparent, so the users can know how to use it and adjust it for the specifics of the file they are processing.

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

Sidebar

Related Questions

I read a file which only contains one line. However, I can't stop reading
i want to know how can i read from file in java until the
Possible Duplicate: Reading from text file until EOF repeats last line c++ EOF running
I read file from user using FileReference. I have a variable which I want
I am trying to read file and split its line to get some context(Computer
I'm having problems reading this one JPEG file using ImageIO.read(File file) - it throws
I'm programming Java in Eclipse IDE. Here is code I want to read file:
The task I have is to (somewhat efficiently) read line-by-line through a very large,
Is there a way I can read data from a file until a space?
I want to parse a file and use 2 'new line' (\n) as a

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.