private T deserializeMetadata(byte[] bytes) throws IOException, ClassNotFoundException { return (T) SerializationUtils.deserializeFromBytes(bytes, Metadata.class); }
/** * Deserialize a String obtained via {@link #serialize(Serializable)} into an object, using the * given {@link BaseEncoding}, which must be the same {@link BaseEncoding} used to serialize the object. * * @param serialized The serialized String * @param clazz The class the deserialized object should be cast to. * @param enc The {@link BaseEncoding} used to decode the String. * @return The deserialized object * @throws IOException if it fails to deserialize the object */ public static <T extends Serializable> T deserialize(String serialized, Class<T> clazz, BaseEncoding enc) throws IOException { return deserializeFromBytes(enc.decode(serialized), clazz); }