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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:06:39+00:00 2026-05-14T14:06:39+00:00

I am writing an application that reads in a large number of basic user

  • 0

I am writing an application that reads in a large number of basic user details in the following format; once read in it then allows the user to search for a user’s details using their email:

NAME             ROLE          EMAIL
---------------------------------------------------
Joe Bloggs       Manager       jbm@company.com
John Smith       Consultant    jsc@company.com
Alan Wright      Tester        awt@company.com
...

The problem I am suffering is that I need to store a large number of details of all people that have worked at the company. The file containing these details will be written on a yearly basis simply for reporting purposes, but the program will need to be able to access these details quickly.

The way I aim to access these files is to have a program that asks the user for the name of the unique email of the member of staff and for the program to then return the name and the role from that line of the file. I’ve played around with text files, but am struggling with how I would handle multiple columns of data when it comes to searching this large file.

What is the best format to store such data in? A text file? XML? The size doesn’t bother me, but I’d like to be able to search it as quickly as possible. The file will need to contain a lot of entries, probably over the 10K mark over time.


EDIT: I’ve decided to go with the XML serialisation method. I’ve managed to get the code for Encoding working perfectly, but the Decoding code below does not work.

XMLDecoder d = new XMLDecoder(
               new BufferedInputStream(new FileInputStream("data.xml")));
List<Employee> list = (List<Employee>) d.readObject();
d.close();
for(Employee x : list) {
    if(x.getEmail().equals(userInput)) {
        // do stuff
    }
}

When the program hits List<Employee> list = (List<Employee>) d.readObject(); an exception is thrown claiming that “Employee cannot be cast to java.util.List”. I’ve added a bounty to this and anyone that can help me solve this problem once and for all will get lots of lovely points.

EDIT 2: I’ve looked a bit more into the problem and have come across Serialization as a potential answer. If anyone can look into this for me as I’ve no experience with Serialization or Deserialization I’d be very grateful. It can provide an Object with no problems whatsoever, but I really need to return it in the same format as it went in (List).

EDIT 3: Ugh, this problem is really starting to drive me crazy and to be honest I’m starting to think that it’s an unsolvable problem. If possible, could someone take a look at the code and help provide a solution for me?

  • 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-14T14:06:40+00:00Added an answer on May 14, 2026 at 2:06 pm

    Okay, I’ve finally managed to solve the problem of handling the Objects once they’ve been decoded through ArrayList rather than through List<Employee>. I use XMLEncoder to encode an ArrayList into an XML file once split into its separate pieces, and then I use XMLDecoder to take out the Objects, cast them to Employee and then use them as needed.

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

Sidebar

Related Questions

I am writing a quick and dirty application that reads all the files from
I'm writing a C/C++ application under Linux that reads data from a raw socket
I am writing an application that downloads large files in the background. All clients
I am writing an application that if the user hits back, it may resend
I'm writing an application which reads large arrays of floats and performs some simple
im writing an application that downloads and installs addons for programs which needs to
I'm writing an application that on some stage performs low-level disk operations in Linux
I am writing an application that needs to bring window of an external app
I'm writing an application that is basically just a preferences dialog, much like the
I am current writing an application that will require multiple inserts, updates and deletes

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.