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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:44:09+00:00 2026-06-06T17:44:09+00:00

I am working on a basic encryption program for a school project, and I

  • 0

I am working on a basic encryption program for a school project, and I want to have easily interchangable keys. As it stands, I have a encryption class and a decryption class, with multiple methods. One of those methods is the key that I want to print to a file. Because I will be making many changes to those two classes (apart from the keys), I want to be able to print just that one method to a file. I also need to be able to load it again. Is there any easy way to do this?

  • 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-06T17:44:11+00:00Added an answer on June 6, 2026 at 5:44 pm

    You could use java serialization, as you commented that you have a String array to save, you could do something like this:

    // save object to file
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("/tmp/file")));
    oos.writeObject(myArray); // where myArray is String[]
    
    // load object from file
    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("/tmp/file")));
    String[] read = (String[]) ois.readObject();
    

    A working example ;), saving the arguments received with the application execution.

    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.util.Arrays;
    
    public class TestSerialization {
    
        public static void main(final String[] array) throws FileNotFoundException, IOException, ClassNotFoundException {
            // save object to file
            ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("/tmp/file")));
            oos.writeObject(array); // where myArray is String[]
    
            // load object from file
            ObjectInputStream ois = new ObjectInputStream(new FileInputStream(new File("/tmp/file")));
            String[] read = (String[]) ois.readObject();
    
            System.out.println(Arrays.toString(read));
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic server working but I want to be able to press
I'm working on a simple program that uses OpenSSL to do basic RSA encryption
Mornin', I'm trying to just get basic encryption working using System.Security.Cryptography.RjindaelManaged. I have google
I have a service, as follows: The most basic (working) CherryPy 3.1 Windows service
I'm working on a basic DBMS as a pet project and planning to prototype
I have basic authentatication working with REST API using curl: curl -X POST -H
I am working with a basic C++ program to determine the area and perimeter
A friend and I have written an encryption module and we want to port
I have been working with basic SQL for a couple years already. However, only
I have a basic working knowledge of Castle Windsor, but I cannot figure out

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.