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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:35:48+00:00 2026-05-25T13:35:48+00:00

Good afternoon in my timezone. I am working with JavaMail api with exJello Provider.

  • 0

Good afternoon in my timezone.

I am working with JavaMail api with exJello Provider. I am using SearchTerm class to filter the retrieved messages but it takes in average more than 1 minute to the search method returns results.So i decided to serialize a set of messages this way i did not have to wait so long.so i have one theoretical issue and one specif issue.
1) Only the classes that implements the Serializable interface could be serialize so the way i use to “serialize” this messages is not a “really” serialization, right ?
Snippet of my code : message.writeTo(“OutputStream”);

2) Now the problem that i am dealing with:
Snippet of code:

  messages = inbox.search(new AndTerm(terms));
  ObjectOutputStream stream = new ObjectOutputStream(new  FileOutputStream("serializer.txt"));
   for(Message msg : messages){
      msg.writeTo(stream);
    }

In the end of the process i had serialize more than one message in the file “serializer.txt”. My question is how can i deserialize those messages.I already am able to deserialize one messeage , but if the file contains more than one message only the first one get deserialize.
Code:

ObjectInputStream file = new ObjectInputStream(new FileInputStream("serializer.txt"));
new MimeMessage(session,file);

This code will deserialize just one message , but if i make a cicle only the first one will be again deserialize. So any body had face the same issue.
PS-> If i try to use the method readObject from any InputStream it will retrieve an exception, the only way is to use the Message constructor.

With the best regards

  • 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-25T13:35:49+00:00Added an answer on May 25, 2026 at 1:35 pm

    You can try ObjectInputStream.readObject()

    ObjectInputStream messages= new ObjectInputStream(new FileInputStream("serializer.txt"));
    while(messages.available()){
       MimeMessage message = (MimeMessage)messages.readObject()
       ....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good Afternoon, I am trying to use the composite filter but in vain. While
Good afternoon in my timezone. I am developing a web application using struts framework,
Good afternoon, We are using the latest C/C++ version of PCRE on WINDOWS Visual
Good afternoon, I'm working on a project for my company to run an update
Good afternoon, I'm having a problem with a section of code I'm working on
Good afternoon in my timezone. I have a table with four tr and each
good afternoon,I'm trying to install mysql-5.5.29 source code on ubuntu. but cmake just shows:Configuring
Good afternoon, We are building a prototype of a deduper. We are using a
Good afternoon all, I dont know why this is proving so difficult but I
Good afternoon all, I've noticed they're a few similar problems on here already but

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.