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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:48:49+00:00 2026-05-26T21:48:49+00:00

Me and a group of friends are working on a project in Java, and

  • 0

Me and a group of friends are working on a project in Java, and we need some help regarding sending objects through sockets.

So far, we have achieved to send simple objects (ints, strings and whatnot) through sockets, using ObjectOutputStream and ObjectInputStream. However, we ran into a huge problem today (huge for us, anyway ^^)

We have a tree structure, that we need to send from one PC to another. The problem is that, within each node of that tree, we have a reference to a BufferedImage and it’s not serializable.

We have been researching a lot today, and we found out that we can use ImageIO.write() to send one BufferedImage through the socket’s OutputStream, however, it’s no good to us since we don’t need to send the BufferedImage by itself, but the whole tree were it is located.

What we need is a way (if it exists) to serialize each BufferedImage, converting it to another class if necessary, while making the tree, and having each node of the tree reference that new serializable class instead, so the tree can be sent as a whole object…

We really don’t care about performance, since the trees we’re sending aren’t that big (10-15 nodes top). Thanks in advance for the help, sorry for the lousy English. Oh, and this is for a… well, a kind of homework, in case you want to keep that in mind 🙂

Thanks!!

  • 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-26T21:48:50+00:00Added an answer on May 26, 2026 at 9:48 pm

    on each node you can use writeObject() and readObject() check http://java.sun.com/developer/technicalArticles/Programming/serialization/ for more info

    essentially it will become

    public Node implements Serializable{
    
        transient BufferedImage buff;//transient make it so it won't be written with defaultWriteObject (which would error)
    
        private void writeObject(ObjectOutputStream out)throws IOException{
            out.defaultWriteObject();
            //write buff with imageIO to out
        }
    
        private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{
            in.defaultReadObject();
            //read buff with imageIO from in
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a group project for a college course, and I've hit
I have some troubles when using javascript code for Facebook invite friends. Details: User
I have to send sms periodically through my android application to a certain group
I'm trying to come up with the largest possible group of friends that would
My group has a source analysis tool that enforces certain styles that we have
A group of developers that I am working with switched from VSS to SVN
Summer is coming, and a group of friends and I are getting ready for
I'm building a forum for my friends to use, but since we have been
A groups of friends are working on a little game that would listen to
I have a group feature on my website that allows 1 user to put

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.