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 796859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:42:22+00:00 2026-05-14T22:42:22+00:00

I am working on a software product with an integrated log file viewer. Problem

  • 0

I am working on a software product with an integrated log file viewer. Problem is, its slow and unstable for really large files because it reads the whole file into memory when you view a log file. I’m wanting to write a new log file viewer that addresses this problem.

What are the best practices for writing viewers for large text files? How does editors like notepad++ and VIM acomplish this? I was thinking of using a buffered Bi-directional text stream reader together with Java’s TableModel. Am I thinking along the right lines and are such stream implementations available for Java?

Edit: Will it be worthwhile to run through the file once to index the positions of the start of each line of text so that one knows where to seek to? I will probably need the amount of lines, so will probably have to scan through the file at least once?

Edit2: I’ve added my implementation to an answer below. Please comment on it or edit it to help me/us arrive at a more best-practice implementation or otherwise provide your own.

  • 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-05-14T22:42:23+00:00Added an answer on May 14, 2026 at 10:42 pm

    I’m not sure that NotePad++ actually implements random access, but I think that’s the way to go, especially with a log file viewer, which implies that it will be read only.

    Since your log viewer will be read only, you can use a read only random access memory mapped file “stream”. In Java, this is the FileChannel.

    Then just jump around in the file as needed and render to the screen just a scrolling window of the data.

    One of the advantages of the FileChannel is that concurrent threads can have the file open, and reading doesn’t affect the current file pointer. So, if you’re appending to the log file in another thread, it won’t be affected.

    Another advantage is that you can call the FileChannel’s size method to get the file size at any moment.

    The problem with mapping memory directly to a random access file, which some text editors allow (such as HxD and UltraEdit), is that any changes directly affect the file. Therefore, changes are immediate (except for write caching), which is something users typically don’t want. Instead, users typically don’t want their changes made until they click Save. However, since this is just a viewer, you don’t have the same concerns.

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

Sidebar

Related Questions

I am working on a software product line for online-tests automatic builds in coordination
I'm currently working on my Bachelors dissertation. This involves developing a software product and
Since I am working on a product software, I need help from you to
I am working a software that uses Qt and has existing methods to encrypt/decrypt
I am using and working on software which uses MySQL as a backend engine
We have situation where say we have four engineers that are working on software
The software company I'm working for builds software for schools, and so our client
I'm working on a software project which several members are working from home and
I am working on a software-as-a-service (SaaS) application and I am looking for a
I'm working on some software to manage a device that communicates with a remote

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.