Java Byte Array to Object deserialize(byte[] bytes)

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

Description

deserialize

License

Open Source License

Declaration

public static Object deserialize(byte[] bytes) 

Method Source Code


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

import java.io.*;

public class Main {
    public static Object deserialize(byte[] bytes) {
        if (bytes == null) {
            return null;
        }// ww  w.j av  a 2s .com
        try {
            ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
            return ois.readObject();
        } catch (IOException ex) {
            throw new IllegalArgumentException("Failed to deserialize object", ex);
        } catch (ClassNotFoundException ex) {
            throw new IllegalStateException("Failed to deserialize object type", ex);
        }
    }
}

Related

  1. deserialize(byte[] buf)
  2. deserialize(byte[] buf)
  3. deserialize(byte[] buffer, int count)
  4. deserialize(byte[] byteArray)
  5. deserialize(byte[] byteArray)
  6. deserialize(byte[] bytes)
  7. deserialize(byte[] bytes)
  8. deserialize(byte[] bytes)
  9. deserialize(byte[] bytes)