Java Object Deserialize Deserialize(byte[] objectBytes)

Here you can find the source of Deserialize(byte[] objectBytes)

Description

Deserialize a object

License

Creative Commons License

Parameter

Parameter Description
objectBytes Serialize object

Exception

Parameter Description
IOException an exception
ClassNotFoundException an exception

Return

Deserialized Object

Declaration

public static Object Deserialize(byte[] objectBytes) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
/* // w w w .j av  a2 s.c om
 * Created: 12/05/2014
 * Author: Luke Salisbury <luke.salisbury@live.vu.edu.au>
 * Student Number: 1510439
 * Course: Programming for Networks 
 * Subject: ECB2123
 * License: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 
 * License URL: http://creativecommons.org/licenses/by-nc-sa/4.0/
 *
 * Implement a Tutoring System that would register tutors interested in 
 * helping students
 */

import java.io.*;

public class Main {
    /**
     * Deserialize a object 
     * @param objectBytes Serialize object
     * @return Deserialized Object
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public static Object Deserialize(byte[] objectBytes) throws IOException, ClassNotFoundException {
        ByteArrayInputStream byteStream;
        ObjectInput input;
        Object object;

        byteStream = new ByteArrayInputStream(objectBytes);

        input = new ObjectInputStream(byteStream);
        object = input.readObject();
        input.close();

        return object;
    }
}

Related

  1. deserialize(byte[] data)
  2. deserialize(byte[] data)
  3. deserialize(byte[] features)
  4. deserialize(byte[] in)
  5. deserialize(byte[] in)
  6. deserialize(byte[] objectData)
  7. deserialize(byte[] objectData)
  8. deserialize(byte[] objectData)
  9. deserialize(byte[] objectData)