Here you can find the source of deserialize(byte[] data)
Parameter | Description |
---|---|
data | the data |
Parameter | Description |
---|---|
IOException | Signals that an I/O exception has occurred. |
ClassNotFoundException | the class not found exception |
public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; public class Main { /**/*from w w w. jav a 2 s.c om*/ * Deserializes a packet. * * @param data the data * @return packet * @throws IOException Signals that an I/O exception has occurred. * @throws ClassNotFoundException the class not found exception */ public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException { ByteArrayInputStream in = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(in); return is.readObject(); } }