Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /Serializarion and Deserialization /Examples /Deserialization.java
Download data/train/akash-coded/FSD_Java/Lesson-3/Serializarion and Deserialization/Examples/Deserialization.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 779 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/main/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion%20and%20Deserialization/Examples/Deserialization.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion and Deserialization/Examples/Deserialization.java'
-
curl -L -o Deserialization.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/main/data/train/akash-coded/FSD_Java/Lesson-3/Serializarion%20and%20Deserialization/Examples/Deserialization.java
779 Bytes
| import java.io.*; | |
| class Deserialization { | |
| public static void main(String args[]) throws IOException { | |
| ObjectInputStream in = null; | |
| FileInputStream fin = null; | |
| try { | |
| // Reading the object file | |
| fin = new FileInputStream("f.txt"); | |
| // Creating stream to read the object | |
| in = new ObjectInputStream(fin); | |
| Student s = (Student) in.readObject(); | |
| // printing the data of the serialized object | |
| System.out.println(s.rollNumber + " " + s.name); | |
| } catch (Exception e) { | |
| System.out.println(e); | |
| } finally { | |
| // closing the stream | |
| in.close(); | |
| // closing the file input stream | |
| fin.close(); | |
| } | |
| } | |
| } | |