Last active
December 22, 2015 00:48
-
-
Save TheLouisHong/6391940 to your computer and use it in GitHub Desktop.
A program that reads unknown Serialized objects, with problems,.....
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
package com.louishong; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.lang.reflect.Field; | |
public class ReadFile{ | |
int i=0; | |
public static void main(String args[]){ | |
File f = new File(args[0]); | |
try{ | |
ObjectInputStream objStream = new ObjectInputStream(new FileInputStream(f)); | |
Object obj = objStream.readObject(); | |
Class<?> clazz = obj.getClass(); | |
System.out.println(clazz.getName()); | |
objStream.close(); | |
System.out.println("Deserializing Operation Completly Successfully."); | |
} | |
catch(ClassNotFoundException e){ | |
System.out.println(e.getMessage()); | |
} | |
catch(FileNotFoundException fe){ | |
System.out.println("File not found "); | |
} catch (IOException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment