Code example for ByteArrayInputStream

Methods: close

0
     * @return the deserialized {@link Object} 
     * @throws Exception if the deserialization is failed. 
     */ 
    public static Object deserializeFromByteArray(byte[] bytes) throws Exception {
 
    	ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
    	ObjectInput in = null;
    	try { 
    	  in = new ObjectInputStream(bis);
    	  Object o = in.readObject(); 
    	   
    	  return o;
    	   
    	} finally { 
    	  bis.close();
    	  in.close();
    	} 
    } 
 
}