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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:15:47+00:00 2026-05-15T10:15:47+00:00

In my program i want the user to be able to take some images

  • 0

In my program i want the user to be able to take some images from a directory, and save them under a single file, that can be transferred to another computer possibly, and actually read and displayed(using the same program).

How would i go about doing this, especially if i want to save other data along with it, perhaps objects and such. I know you can use the ObjectOutputStream class, but im not sure how to integrate it with images.

So overall, i want the program to be able to read/write data, objects, and images to/from a single file.

Thanks in Advance.

[EDIT – From Responses + Comment regarding Zip Files]

A zip might be able to get the job done.

But i want it to be read only be the program. ( You think making it a zip, changing the file extension would work, then when reading it just chaing it back and reading as a zip?? ) I dont want users to be able to see the contents directly.

Ill elaborate a bit more saying its a game, and users can create their own content using xml files, images and such. But when a user creates something i dont want other users to be able to see exactly how they created it, or what they used, only the end result.

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

    You can programatically create a zip file, and read a zip file from Java, no need to expose it as a regular .zip file.

    See: java.io.zip pacakge for more information, and these others for code samples on how to read/write zip using java.

    Now if you want to prevent the users from unzipping this file, but you don’t want to complicate your life by encrypting the content, or creating a complex format, you can emulate a simple internet message format, similar to the one used for e-mails to attach files.

    You can read more about the internet message format here

    This would be a custom file format only used by your application so you can do it as simple as you want. You just have to define your format.

    It could be:

    • Header with the names ( and number ) of files in that bundle.
    • Followed by a list of separators ( for instance limit.a.txt=yadayada some identifier to know you have finished with that content )
    • Actual content

    So, you create the bundle with something like the following:

    public void createBundle() {
        ZipOutputStream out = .... 
        writeHeader( out );
        writeLimits( out yourFiles );
        for( File f : youFiles ) {
            writeFileTo( f, out );
         }
         out.close();
    }
    

    Sort of…

    And the result would be a zipped file with something like:

     filenames =a.jpg, b.xml, c.ser, d.properties, e.txt
     limits.a.jpg =poiurqpoiurqpoeiruqeoiruqproi
     limits.b.xml =faklsdjfñaljsdfñalksjdfa
     limit.s.ser =sdf09asdf0as9dfasd09fasdfasdflkajsdfñlk
     limit.d.properties =adfa0sd98fasdf90asdfaposdifasdfklasdfkñm
     limit.e.txt =asdf9asdfaoisdfapsdfñlj
     attachments=
     <include binary data from a.jpg here>
     --poiurqpoiurqpoeiruqeoiruqproi
     <include binary data from b.xml here>
     --faklsdjfñaljsdfñalksjdfa
    

    etc

    Since is your file format you can keep it as simple as possible or complicate your life at infinitum.

    If you manage to include a MIME library in your app, that could save you a lot of time.

    Finally if you want to add extra security, you have to encrypt the file, which is not that hard after all, the problems is, if you ship the encrypting code too, your users could get curious about it and decompile them to find out. But a good encrypting mechanism would prevent this.

    So, depending on your needs you can go from a simple zip, a zip with a custom format, a zip with a complicated customformat or a zip with a custom complicated encrypted format.

    Since that’s to broad you may ask about specific parts here: https://stackoverflow.com/questions/ask

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

Sidebar

Related Questions

I want to create a program that requests from the user 10 grades and
In my program I want the user to be able to choose between some
I want to create a program that will take user input and create a
I want to make a program that will simulate a user browsing a site
I want to write a java program that acts as a user interface to
I want to write a program that sets cold to true if the user
I want to write a simple program that determines whether the number the user
I made a program that generates some data and want to show it in
I have a web program where I want the user to be able to
I'm writing a program and I want the user to be able to specify

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.