-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ca9d95
commit 36f0cd2
Showing
13 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-17.0.7.7-hotspot"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>serializationAndDeseralization</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions
2
serializationAndDeseralization/.settings/org.eclipse.core.resources.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=UTF-8 |
14 changes: 14 additions & 0 deletions
14
serializationAndDeseralization/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=17 |
Binary file not shown.
Binary file added
BIN
+1.36 KB
serializationAndDeseralization/bin/serializationAndDeseralization/deserial.class
Binary file not shown.
Binary file added
BIN
+1.57 KB
serializationAndDeseralization/bin/serializationAndDeseralization/serial.class
Binary file not shown.
Binary file added
BIN
+1.28 KB
serializationAndDeseralization/bin/serializationAndDeseralization/student.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* | ||
*/ | ||
module serializationAndDeseralization { | ||
} |
31 changes: 31 additions & 0 deletions
31
serializationAndDeseralization/src/serializationAndDeseralization/deserial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package serializationAndDeseralization; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.ObjectInputStream; | ||
|
||
public class deserial { | ||
public static void main(String[] args) { | ||
try { | ||
FileInputStream fileInputStream = new FileInputStream("C:\\Users\\Admin\\IdeaProjects\\module1\\src\\module1\\experiment1\\file.txt"); | ||
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); | ||
student s1 = (student) objectInputStream.readObject(); | ||
student s2 = (student) objectInputStream.readObject(); | ||
student s3 = (student) objectInputStream.readObject(); | ||
student s4 = (student) objectInputStream.readObject(); | ||
student s5 = (student) objectInputStream.readObject(); | ||
|
||
System.out.println(s1); | ||
System.out.println(s2); | ||
System.out.println(s3); | ||
System.out.println(s4); | ||
System.out.println(s5); | ||
objectInputStream.close(); | ||
|
||
} | ||
catch (Exception e){ | ||
System.out.println(e); | ||
} | ||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
serializationAndDeseralization/src/serializationAndDeseralization/serial.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package serializationAndDeseralization; | ||
import java.io.FileOutputStream; | ||
import java.io.ObjectOutputStream; | ||
|
||
public class serial { | ||
public static void main(String[] args) { | ||
try { | ||
student s1 = new student(1,116,"Akash","CSE","PU"); | ||
student s2 = new student(2,117,"Rahul","CSE","PU"); | ||
student s3 = new student(3,118,"Rohit","CSE","PU"); | ||
student s4 = new student(4,119,"Raj","CSE","PU"); | ||
student s5 = new student(5,120,"Ravi","CSE","PU"); | ||
|
||
FileOutputStream fileOutputStream = new FileOutputStream("C:\\Users\\Admin\\IdeaProjects\\module1\\src\\module1\\experiment1\\file.txt"); | ||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); | ||
objectOutputStream.writeObject(s1); | ||
objectOutputStream.writeObject(s2); | ||
objectOutputStream.writeObject(s3); | ||
objectOutputStream.writeObject(s4); | ||
objectOutputStream.writeObject(s5); | ||
objectOutputStream.flush(); | ||
objectOutputStream.close(); | ||
System.out.println("Sucess"); | ||
|
||
} | ||
catch (Exception e){ | ||
System.out.println(e); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
serializationAndDeseralization/src/serializationAndDeseralization/student.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package serializationAndDeseralization; | ||
|
||
import java.io.Serializable; | ||
|
||
public class student implements Serializable { | ||
int id; | ||
int rollNo; | ||
String name; | ||
String branch; | ||
String college; | ||
|
||
public student(int id, int rollNo, String name, String branch, String college) { | ||
super(); | ||
this.id = id; | ||
this.rollNo = rollNo; | ||
this.name = name; | ||
this.branch = branch; | ||
this.college = college; | ||
} | ||
public String toString(){ | ||
return "Student [id=" + id + ", rollNo=" + rollNo + ", name=" + name + ", branch=" + branch + ", college=" + college + "]"; | ||
} | ||
|
||
} |