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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:05:18+00:00 2026-06-09T12:05:18+00:00

I am working on an application, that should have the possibility to save/load data.

  • 0

I am working on an application, that should have the possibility to save/load data. Most of the data is stored in instances of a class. The data in the instances consist of:

  • a double[][] array
  • some String, int, bool and some enumerators

I have multiple of those instances + some global data that I want to store in a single file.

So far I save all of it as binary data, using

DataOutputStream out = new DataOutputStream(FileOutputStream(file));
out.writeInt()/writeBoolean()/writeUTF()/etc

This works good, the problem is that it is not very flexible. If I add/remove some variables to my container class, there is no simple way to still have the old format be compatible. I started using a version number that I add at the start of the file. But this results in a big loadData/closeData method for every format version.

Text based files are out of the question, because they use way too much space for my double array.

Do you know a good way to solve this problem? I.e. define a backward compatible format that does not result in a huge amount of code? Any suggestions are appreciated.

An idea that I am thinking of is to mark every variable with an integer identifying that variable. So the format would be [identifier1][variable1(String)][identifier2][variable2(double[][])]....

I also thought of serialization, but I don’t have any experience and can not really tell if that is the right way to do it.

Please comment if you need more information about the data or some examples.

  • 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-09T12:05:19+00:00Added an answer on June 9, 2026 at 12:05 pm

    http://code.google.com/p/protobuf/ is Google’s nice cross-platform (and cross-language) way of storing data, with backwards compatibility already baked in, could give it a try.

    In particular this part of the documentation pertains to your case:

    New fields could be easily introduced, and intermediate servers that didn’t need to inspect the data could simply parse it and pass through the data without needing to know about all the fields.

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

Sidebar

Related Questions

I am working on splitting out an existing, working application that I currently have
We are working on a web application that is distributed across 3 load-balanced web
I am currently working on an application that should be able to detect wifi
I'm working on some application that should fetch current location and after device is
I am currently developing an application in C# (.NET 4.0) that should have as
Basically I have a working application that sends an SMS after receiving an SMS.
I have a Windows Forms application that I'm working on, but I'm having trouble
I have a web application that I am currently working on that uses a
I have a Mono application that should not show on the dock, but will
I'm working on a GPGPU application that transfers data between the cpu and gpu

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.