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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:35:23+00:00 2026-05-26T10:35:23+00:00

I have a java project in which I have to save the data of

  • 0

I have a java project in which I have to save the data of each run for later use. The professor wants us to use a RandomAccessFile to do this so I have to convert the objects to bytes so they can be stored in the RAF. The major problem is that if we use Serializable he’ll deduct points,so my question is:

Is there a way to convert object to byte array and viceversa without serialization?

I don’t want a full code just an approach to on how to do it is appreciated.

EDIT:

Thank you all for the advice, I ended up converting the objects fields to bytes and writing that to the RAF.

  • 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-26T10:35:24+00:00Added an answer on May 26, 2026 at 10:35 am

    You can write primitives and a few objects (Strings, byte arrays, and boxed primitives like Boolean and Integer which will be unboxed) directly to the RAF. If you have a larger object, break it into something RAF can accept. For example, if you have a list of strings, loop over them and write each with writeUTF. Remember that you have to read it back in, so you’ll have to use some kind of headers. For example, you’ll probably want to write the length of the list before the elements.

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

Sidebar

Related Questions

I am doing a project in java swing in which I have to use
I have a Java project which I'd like to convert to C#, and after
I have a java project in eclipse which are using tomcat. This project has
I have a Java project which has this file structure (shown in Eclipse): ProjectName
i have a java ee project which has a text file that uses a
I have a java project in which I have Referenced Libraries. In the Referenced
I have to give a general note to some huge Java project for which
In my java-swing project. I have one frame in which user can drop the
I have a java project I want to create which will be built on
I have a large project in my workspace. Each time I save a jsp

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.