Java Object Deserialize deserialize(byte[] data)

Here you can find the source of deserialize(byte[] data)

Description

Deserializes a packet.

License

Open Source License

Parameter

Parameter Description
data the data

Exception

Parameter Description
IOException Signals that an I/O exception has occurred.
ClassNotFoundException the class not found exception

Return

packet

Declaration

public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException 

Method Source Code


//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();
    }
}

Related

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