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

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

Description

deserialize

License

Apache License

Declaration

public static <T> T deserialize(byte[] byteArray) 

Method Source Code


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

import java.io.*;

public class Main {
    public static <T> T deserialize(byte[] byteArray) {
        ObjectInputStream oip = null;
        try {/*  w ww.j ava 2s.co  m*/
            oip = new ObjectInputStream(new ByteArrayInputStream(byteArray));
            @SuppressWarnings("unchecked")
            T result = (T) oip.readObject();
            return result;
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        } finally {
            if (oip != null) {
                try {
                    oip.close();
                } catch (IOException e) {
                    // eat it
                }
            }
        }
    }
}

Related

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