Java Object Deserialize deserialize(byte[] serializedObject)

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

Description

deserialize

License

Apache License

Parameter

Parameter Description
serializedObject is a serialized Object as byte-array.

Return

the de-serialized .

Declaration

public static Object deserialize(byte[] serializedObject) 

Method Source Code


//package com.java2s;
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0 */

import java.io.ByteArrayInputStream;

import java.io.ObjectInputStream;

public class Main {
    /**/*from www.j av a 2 s.  com*/
     * @param serializedObject is a serialized {@link Object} as byte-array.
     * @return the de-serialized {@link Object}.
     */
    public static Object deserialize(byte[] serializedObject) {

        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(serializedObject);
            ObjectInputStream ois = new ObjectInputStream(bais);
            Object result = ois.readObject();
            ois.close();
            return result;
        } catch (Exception e) {
            throw new RuntimeException("Failed to deserialize!", e);
        }
    }
}

Related

  1. deserialize(byte[] serial)
  2. deserialize(byte[] serial)
  3. deserialize(byte[] serialized)
  4. deserialize(byte[] serializedData)
  5. deserialize(byte[] serializedData, int startPos, int length)
  6. deserialize(byte[] sf)
  7. deserialize(final byte[] data)
  8. deserialize(final byte[] data)
  9. deserialize(final byte[] inBytes)