Java Object Serialize and Deserialize deserialize(String serializedObject)

Here you can find the source of deserialize(String serializedObject)

Description

deserialize

License

Open Source License

Declaration

public static Object deserialize(String serializedObject) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayInputStream;

import java.io.ObjectInputStream;

import java.util.Base64;

public class Main {
    public static Object deserialize(String serializedObject) {
        try {/*from   ww w  .  j ava  2  s .c  o  m*/
            byte b[] = Base64.getDecoder().decode(serializedObject);
            ByteArrayInputStream bi = new ByteArrayInputStream(b);
            ObjectInputStream si = new ObjectInputStream(bi);
            return si.readObject();
        } catch (Exception e) {
            System.out.println(e);
            return null;
        }
    }

    public static Object deserialize(byte[] bytes) {
        try {
            ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
            ObjectInputStream si = new ObjectInputStream(bi);
            return si.readObject();
        } catch (Exception e) {
            System.out.println(e);
            return null;
        }
    }
}

Related

  1. deserialiseFromByteArray(byte b[])
  2. deserializaObjeto(byte[] bytes, Class tipo)
  3. deserialize(final String serializable, final Class valueType)
  4. deserialize(String name)
  5. deserialize(String serialized)
  6. deserialize(String str)
  7. deSerialize(String str)
  8. deserializeAndCheckObject(final byte[] object, final Class type)
  9. deserialized(final byte[] data)