Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.FileInputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

public class Main {
    public static Object readSerializableObjectFromFile(FileInputStream fileIn) {
        Object b = null;
        ObjectInputStream in = null;
        try {
            in = new ObjectInputStream(fileIn);
            b = in.readObject();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

        return b;
    }
}