Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.*;

public class Main {
    public static Object fromByteArray(byte[] inputBytes) {
        Object obj = null;
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(inputBytes);
        ObjectInput objIn = null;
        try {
            objIn = new ObjectInputStream(byteArrayInputStream);
            obj = objIn.readObject();
        } catch (java.io.IOException ioe) {
            return null;
        } catch (java.lang.ClassNotFoundException cnfe) {
            return null;
        } finally {
            try {
                byteArrayInputStream.close();
                objIn.close();
            } catch (java.io.IOException closeIOE) {

            }
        }
        return obj;
    }
}