src/org/kocakosm/pitaya/io/ObjectCodec.java
public static <T extends Serializable> T decode(byte[] bytes, Class<T> t)
	{
		Parameters.checkNotNull(t);
		Parameters.checkNotNull(bytes);
		ObjectInputStream ois = null;
		ByteArrayInputStream in = new ByteArrayInputStream(bytes);
		try {
			ois = new ObjectInputStream(in);
			return Parameters.checkType(ois.readObject(), t);
		} catch (IOException ex) {
			throw new DecodingException(ex);
		} catch (ClassNotFoundException ex) {
			throw new DecodingException(ex);
		} finally {
			IO.close(ois);
		}
	}
public static <T extends Serializable> T decode(byte[] bytes, Class<T> t)
	{
		Parameters.checkNotNull(t);
		Parameters.checkNotNull(bytes);
		ObjectInputStream ois = null;
		ByteArrayInputStream in = new ByteArrayInputStream(bytes);
		try {
			ois = new ObjectInputStream(in);
			return Parameters.checkType(ois.readObject(), t);
		} catch (IOException ex) {
			throw new DecodingException(ex);
		} catch (ClassNotFoundException ex) {
			throw new DecodingException(ex);
		} finally {
			IO.close(ois);
		}
	}
Deserializes the given array of {@code byte}s into an object.

@param <T> the object's expected type.
@param bytes the object's encoding.
@param t the object's expected type's {@code Class}.

@return the deserialized object.

@throws NullPointerException if one of the arguments is {@code null}.
@throws DecodingException if the deserialization fails.
@throws ClassCastException if the deserialized object is not an
instance of the expected class.