Java Object Serialize and Deserialize deserializeObjectFromByteArray(byte[] theSerializedVersion)

Here you can find the source of deserializeObjectFromByteArray(byte[] theSerializedVersion)

Description

Deserialize the object that was serialized into the given byte-array.

License

Open Source License

Declaration

public static Object deserializeObjectFromByteArray(byte[] theSerializedVersion)
        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 {
    /**/*  w w  w .j ava2 s  . c  o  m*/
     * Deserialize the object that was serialized into the given byte-array.
     * @see http://www.velocityreviews.com/forums/t561666-how-to-serialize-a-object-to-a-string-or-byte.html
     */
    public static Object deserializeObjectFromByteArray(byte[] theSerializedVersion)
            throws IOException, ClassNotFoundException {
        final ByteArrayInputStream bais = new ByteArrayInputStream(theSerializedVersion);
        final ObjectInputStream input = new ObjectInputStream(bais);
        return input.readObject();
    }
}

Related

  1. deSerializeObj(byte[] array)
  2. deSerializeObject(byte[] base64SerializedObject)
  3. deserializeObject(String dir)
  4. deSerializeObject(String str, Class cls)
  5. deserializeObjectFromByteArray(byte[] data)
  6. deserializeProperties(byte[] bytes)
  7. deserializeRaw(byte[] array)
  8. deserializeSafe(byte[] buf, T obj)
  9. deserializeShort(byte[] inbuf, int offset)