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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:24:12+00:00 2026-06-03T01:24:12+00:00

For processing a searchlog file I’m writing a Java class that should read and

  • 0

For processing a searchlog file I’m writing a Java class that should read and handle the file content line by line.

The Text in the Logfile looks like the following

[Integer User ID] [Queury] [Date: YYYY-MM-DD HH:MM:SS] [optional url]

I tried using a scanner and reading the lines with nextLine(), but this reads the whole file as one line. Any idea how I can ensure to only get one line at a time?

  • 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-03T01:24:13+00:00Added an answer on June 3, 2026 at 1:24 am

    You can just grab the entire file as you have it, and then split the data:

    for ( String line : "the entire file".split( System.getProperty("line.separator") )
    {
         System.out.println( line );
    }
    

    As a side note: System.getProperty("line.separator") is the universal new line character.

    An alternative method:

    BufferedReader bufferedReader = new BufferedReader( new FileReader( "absolute file path" ) );
    
    String line;
    
    while ( ( line = bufferedReader.readLine() ) != null)
    {
         System.out.println( line );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I'm processing searchlogs with a java class, but at some point I
After processing form from POST I should redirect, to prevent user from hitting back.
I'm in the processing of converting a program from Perl to Java. I have
after some processing my program shows a messagebox saying you can read a log
We are processing IBMEnterprise Japanese COBOL source code. The rules that describe exactly what
I want to read 4GB file & create a copy of it by making
I have a .plist file that looks like this: <plist version=1.0> <array> <dict> <key>name</key>
I have created a Class Library (called as GNGEngine.dll) which performs some image processing
I am writing a basic word processing application and am trying to settle on
I am attempting to process a plain text file. It is basically an index

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.