Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.io.Serializable;
- public class ClassSerializationIO {
- public static Object readObject( String objectName ) throws FileNotFoundException, IOException, ClassNotFoundException{
- ObjectInputStream in = new ObjectInputStream( new FileInputStream( objectName ) );
- return in.readObject();
- }
- public static void writeObject( Serializable obj, String name ) throws FileNotFoundException, IOException{
- ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream( name ) );
- out.writeObject( obj );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement