Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayInputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

public class Main {
    public static Object deserializeObject(byte[] b) {
        try {
            ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(b));
            Object object = in.readObject();
            in.close();

            return object;
        } catch (ClassNotFoundException cnfe) {
            //         Log.e("deserializeObject", "class not found error", cnfe);

            return null;
        } catch (IOException ioe) {
            //         Log.e("deserializeObject", "io error", ioe);

            return null;
        }
    }
}