![JAR search and dependency download from the Maven repository](/logo.png)
club.pizzalord.shire.serializer.protostuff.ProtostuffDeserializer Maven / Gradle / Ivy
package club.pizzalord.shire.serializer.protostuff;
import club.pizzalord.shire.sdk.exceptions.ShireException;
import club.pizzalord.shire.serializer.core.Deserializer;
import io.protostuff.ProtostuffIOUtil;
import io.protostuff.Schema;
/**
* Protostuff deserializer
*
* @author Xpizza
* @since shire1.0
*/
public class ProtostuffDeserializer implements Deserializer {
@Override
public T deserialize(byte[] data, Class clazz) {
try {
Schema schema = SchemaManager.getSchema(clazz);
T object = schema.newMessage();
ProtostuffIOUtil.mergeFrom(data, object, schema);
return object;
} catch (Exception e) {
throw new ShireException("Failure to deserialize data with protostuff", e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy