Java Utililty Methods Object Deserialize

List of utility methods to do Object Deserialize

Description

The list of methods to do Object Deserialize are organized into topic(s).

Method

Tdeserialize(@Nonnull byte[] byteArray)
Deserialize a byte array of an object.
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
ObjectInput objectInput = null;
try {
    objectInput = new ObjectInputStream(byteArrayInputStream);
    return (T) objectInput.readObject();
} finally {
    try {
        if (objectInput != null) {
...
Objectdeserialize(@Nullable final byte[] binaryInput)
deserialize
return (binaryInput != null) ? deserialize(new ByteArrayInputStream(binaryInput)) : null;
Objectdeserialize(byte[] bytes, boolean zipped)
Deserialize a table of bytes to an Object instance.
ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
ObjectInputStream oi;
if (zipped) {
    oi = new ObjectInputStream(new GZIPInputStream(bi));
} else {
    oi = new ObjectInputStream(bi);
Object o = oi.readObject();
...
Tdeserialize(byte[] bytes, Class clazz)
Deserialize a byte array into an object.
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
Object object = objectInputStream.readObject();
return clazz.cast(object);
Tdeserialize(byte[] bytes, Class clazz)
deserialize
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
    bais = new ByteArrayInputStream(bytes);
    ois = new ObjectInputStream(bais);
    Object object = ois.readObject();
    return clazz.cast(object);
} catch (Exception e) {
...
Tdeserialize(byte[] bytes, Class klass)
deserialize
return OBJECT_MAPPER.readValue(bytes, klass);
Sdeserialize(byte[] bytes, final Class asClass)
TODO
if (bytes != null) {
    try (final ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
        return asClass.cast(input.readObject());
    } catch (IOException | ClassNotFoundException e) {
        e.printStackTrace();
return null;
...
Objectdeserialize(byte[] bytes, List customClassLoaders)
deserialize
try {
    final List<ClassLoader> classLoaderList = customClassLoaders;
    ByteArrayInputStream input = new ByteArrayInputStream(bytes);
    ObjectInputStream ois = new ObjectInputStream(input) {
        @Override
        protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
            String className = desc.getName();
            try {
...
Tdeserialize(byte[] data)
deserialize
try {
    ByteArrayInputStream in = new ByteArrayInputStream(data);
    ObjectInputStream ois = new ObjectInputStream(in);
    return (T) ois.readObject();
} catch (Exception e) {
    e.printStackTrace();
return null;
...
Tdeserialize(byte[] data)
deserialize
ObjectInputStream ois = null;
ByteArrayInputStream is = null;
try {
    is = new ByteArrayInputStream(data);
    ois = new ObjectInputStream(is);
    return (T) ois.readObject();
} catch (Exception e) {
    e.printStackTrace();
...