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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:20:39+00:00 2026-06-12T12:20:39+00:00

I have some input that I add to a serialized object. Now when I

  • 0

I have some input that I add to a serialized object.

Now when I read the serialized object, I want to check if it exists… If not loop till it has a value in it.

How do i modify the deserialization function to handle that.

There is basically a delay in populating my serializable object. So in the meantime if i were to read that object, it is going to be empty. I want to put a check to read only when it has data in it. if not it should wait till it has some data

public String _displayResults(){
String  SomeData = "";
try {
    FileInputStream fis = new FileInputStream("SomeDataobj");
    ObjectInputStream ois = new ObjectInputStream(fis);
    SomeData = (String)ois.readObject();
    ois.close();
}
catch(Exception e) {
    System.out.println("Exception during deserialization: ");
}
return SomeData;
}

What I tried:

added a wait condition for 2 secs for 10 times… Is there a cleaner way.

    while ( ois.readObject().toString().equalsIgnoreCase("") && i <10){
        Thread.sleep(2000);
        i++;
    }
  • 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-12T12:20:41+00:00Added an answer on June 12, 2026 at 12:20 pm

    Java provides an API called Externalizable, which allows you to customize the (de) serialization. Serialiazable is marker interface and that indicates the object can be wrote to output stream. Externalizable provides two methods readExternal() and writeExternal() where you can override the behavior.

    Your question is not so clear about what you want to achieve, so I am not sure if the above information is helpful for you

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

Sidebar

Related Questions

I have an application that takes some input and generates configuration files as output.
I have some dynamic buttons that look like this: <input type=button name=button id=button value=Click
So I have a form that accepts some input from a user that may
I have a web page that prompts for user input via DropDownLists in some
I have an HTML table that contains some 500 rows. I have an input
I have a string input = "maybe (this is | that was) some ((nice
I have a input box that i have some text in site <input type=text
I have a bit of code that concatenates text from some input boxes and
I have some input boxes that are getting different results from different browsers. Here
I'm working with some nastran input files that have the following structure: GRID,1,,0.000,0.000,0.000,0 GRID,2,,0,000,1.653,0.000,0

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.