Java Object Deserialize deserialize(byte[] objectData)

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

Description

deserialize

License

Apache License

Declaration

public static Object deserialize(byte[] objectData) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayInputStream;

import java.io.IOException;
import java.io.ObjectInputStream;

public class Main {

    public static Object deserialize(byte[] objectData) {
        if (objectData == null) {
            throw new IllegalArgumentException("The byte[] must not be null");
        }//from   w  w w .  j  ava  2 s  .c o  m
        ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
        ObjectInputStream in = null;
        try {
            in = new ObjectInputStream(bais);
            return in.readObject();

        } catch (ClassNotFoundException ex) {
            throw new RuntimeException(ex);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
                // ignore close exception
            }
        }
    }
}

Related

  1. deserialize(byte[] features)
  2. deserialize(byte[] in)
  3. deserialize(byte[] in)
  4. Deserialize(byte[] objectBytes)
  5. deserialize(byte[] objectData)
  6. deserialize(byte[] objectData)
  7. deserialize(byte[] objectData)
  8. deserialize(byte[] serial)
  9. deserialize(byte[] serial)