<dependency> <groupId>io.protostuff</groupId> <artifactId>protostuff-yaml</artifactId> <version>1.6.2</version> </dependency> Person person = new Person("John", 25); Schema<Person> schema = RuntimeSchema.getSchema(Person.class); LinkedBuffer buffer = LinkedBuffer.allocate(256); String yamlString = YamlIOUtil.toJSONString(person, schema, buffer); buffer.clear(); byte[] bytes = YamlIOUtil.toByteArray(yamlString); Person person = schema.newMessage(); ProtostuffIOUtil.mergeFrom(bytes, person, schema); public class CustomSerializer implements io.protostuff.Schema<Person> { } Schema<Person> schema = new CustomSerializer();


上一篇:
下一篇:
切换中文