Java has a way to covert its object to binary form which called java serialization, then write it to a file under any extension you want this means you can store your program data into a form no only you know about the actual structure,
One of the most major reason that makes it so handy it is JVM independent that means you don't need to have JVM or java virtual machine on. your laptop after you built your java program
Example :
If you want to make a program for saving passwords or any sensitive files that you are afraid of intruders to hack your information you can buy an application from any company, this is the problem that comes in you don't know how they save your data how they encrypting it so you can use Java serialization for keeping your data safe.
here is how you use it
you need a class for serializing an object
these two methods one which named
public static void serializeObject(Map<Stage, ArrayList<StudentCard>> student)
is for converting java object with all methods and data into the binary form and the other method which named
public static Map<Stage, ArrayList<StudentCard>> deserializeObject(String fileName)
is for bringing back data form wrote file
and here is how to test it we have java object of a student which has 11 properties
name age blood group city mobile number phone number house number email and stage of that student
you have to make a map for storing data first will take stage which u have specified the state of student you want to save and second is the student object and u the only need to call this two method to perform what you want to do
what makes it more impressive if you want to encrypt that binary too this makes it even more secure.
you have to make a map for storing data first will take stage which u have specified the state of student you want to save and second is the student object and u the only need to call this two method to perform what you want to do
what makes it more impressive if you want to encrypt that binary too this makes it even more secure.
Comments
Post a Comment