Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.ByteArrayInputStream;

import java.io.IOException;
import java.io.ObjectInputStream;

public class Main {
    public static Object convertByteArrayToObject(byte[] bytes) throws IOException, ClassNotFoundException {
        ObjectInputStream is = null;
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
        is = new ObjectInputStream(new BufferedInputStream(byteArrayInputStream));
        Object obj = is.readObject();
        is.close();
        return obj;

    }
}