Android Object Deserialization deserializeObject(byte[] b)

Here you can find the source of deserializeObject(byte[] b)

Description

deserialize Object

Declaration

public static Object deserializeObject(byte[] b) 

Method Source Code

//package com.java2s;

import java.io.ByteArrayInputStream;

import java.io.IOException;

import java.io.ObjectInputStream;

import android.util.Log;

public class Main {
    public static Object deserializeObject(byte[] b) {
        try {//from  www.jav  a2 s . c  o m
            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;
        }
    }
}