Here you can find the source of Deserialize(byte[] objectBytes)
Parameter | Description |
---|---|
objectBytes | Serialize object |
Parameter | Description |
---|---|
IOException | an exception |
ClassNotFoundException | an exception |
public static Object Deserialize(byte[] objectBytes) throws IOException, ClassNotFoundException
//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; } }