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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:33:30+00:00 2026-06-14T01:33:30+00:00

So, my problem has basically two sub-problems. I want to create my custom file

  • 0

So, my problem has basically two sub-problems.
I want to create my custom file type, probably with UTF-8 encoding. I think I can do that only by saving a file with prefered extension with some method I don’t know yet to set encoding to UTF-8, or anything that would fit.
My extension would be “.molb”.

Now, the problem is that I need to write 3d Objects, such as Spheres and Cylinders to that file, and when I open the file, to be recognized and added to my Universe in some way.
Some articles were suggesting Serializing objects and using FileBuffers, but none actually helped me understand how can I apply this to my own problem.

To clarify, I will give the following example:
This image
shows some objects (a cylinder and a sphere) that should be saved in a form or another, in a file so when that file is opened, the objects appear with the saved atributes (position, color, orientation etc).Also my file would contain an Array storing the xyz positions of the spheres

  • 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-14T01:33:32+00:00Added an answer on June 14, 2026 at 1:33 am

    if your classes implement Serializable you can write them to file very simply.

    DataOutputStream os = new DataOutputStream(new FileOutputStream("myfile.molb"));
    os.writeObject(sphare);
    os.close();
    

    This file is binary. You do not have to care about encoding.

    If however you want to serialize your object using XML, JSON or other text format you will probably want to open wrap stream with writer using other constructor that accepts encoding: new OutputStreamWriter(new FileOutputStream("my.txt"), "UTF-8)".
    You will also have to add some annotations (e.g. JAXB or Jakson) to enable object-to-xml (or json) serialization.

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

Sidebar

Related Questions

I've created a custom button in my Android app that has basically two different
My problem has probably been asked, but all the ones I've been searching for
I'm facing the following problem : My app has two main controller (a)loginController and
In my Windows Forms Application, basically I have two DataGridView s. I want to
Basically I want to split a square div diagonally in two resulting in two
I created a custom cell using interface builder, it has two labels and one
I basically want to add arrow if the mousehover my navigation. But two rules
This problem has been bugging me for a long time. For example, the code
This problem has bugged me so many times and i have now decided to
my problem has to do with the SimpleModal jQuery plugin . I have no

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.