Here you can find the source of deserialize(byte[] blob)
Parameter | Description |
---|---|
blob | - the blob of bytes to deserialize |
Parameter | Description |
---|---|
IOException | - if it cannot deseriliaze |
IllegalArgumentException | if the blob is null |
static public Object deserialize(byte[] blob) throws IOException, ClassNotFoundException
//package com.java2s; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; public class Main { /**/*from w ww . jav a2 s .co m*/ * Deserialise the specified blob into an Object and return it * to the client. * <p> * If there is an error with the deserialization then throw an * IOException * * @param blob - the blob of bytes to deserialize * @return Object - the object to return * @throws IOException - if it cannot deseriliaze * @throws IllegalArgumentException if the blob is null */ static public Object deserialize(byte[] blob) throws IOException, ClassNotFoundException { if (blob == null) { throw new IllegalArgumentException("null blob to deserialize"); } ByteArrayInputStream bstream = new ByteArrayInputStream(blob); ObjectInputStream istream = new ObjectInputStream(bstream); return istream.readObject(); } }