本文整理汇总了Java中org.msgpack.template.Template.read方法的典型用法代码示例。如果您正苦于以下问题:Java Template.read方法的具体用法?Java Template.read怎么用?Java Template.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.msgpack.template.Template
的用法示例。
在下文中一共展示了Template.read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPrimitiveTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testPrimitiveTypeFieldsClassNotNullable(PrimitiveTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry);
Template<PrimitiveTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(PrimitiveTypeFieldsClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
PrimitiveTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例2: testUserDefinedTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testUserDefinedTypeFieldsClassNotNullable(UserDefinedTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry);
Template<UserDefinedTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(UserDefinedTypeFieldsClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
UserDefinedTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例3: testModifiersFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testModifiersFieldsClassNotNullable(ModifiersFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry);
Template<ModifiersFieldsClassNotNullable> tmpl = builder.buildTemplate(ModifiersFieldsClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
ModifiersFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例4: testInheritanceClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testInheritanceClassNotNullable(InheritanceClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<InheritanceClassNotNullable> tmpl = builder.buildTemplate(InheritanceClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
InheritanceClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例5: testModifiersFieldsClass
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testModifiersFieldsClass(ModifiersFieldsClass v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry);
Template<ModifiersFieldsClass> tmpl = builder.buildTemplate(ModifiersFieldsClass.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
ModifiersFieldsClass ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例6: testUserDefinedTypeFieldsClass
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testUserDefinedTypeFieldsClass(UserDefinedTypeFieldsClass v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionBeansTemplateBuilder builder = new ReflectionBeansTemplateBuilder(registry);
Template<UserDefinedTypeFieldsClass> tmpl = builder.buildTemplate(UserDefinedTypeFieldsClass.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
UserDefinedTypeFieldsClass ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例7: testEnumTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testEnumTypeFieldsClassNotNullable(EnumTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
registry.register(EnumTypeFieldsClassNotNullable.SampleEnum.class,
new OrdinalEnumTemplateBuilder(registry).buildTemplate(EnumTypeFieldsClassNotNullable.SampleEnum.class));
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<EnumTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(EnumTypeFieldsClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
EnumTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例8: testReferenceCycleTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testReferenceCycleTypeFieldsClassNotNullable(ReferenceCycleTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
Template<ReferenceCycleTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(ReferenceCycleTypeFieldsClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
ReferenceCycleTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例9: testListTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testListTypeFieldsClassNotNullable(ListTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<ListTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(ListTypeFieldsClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
ListTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例10: testUserDefinedTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testUserDefinedTypeFieldsClassNotNullable(UserDefinedTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
Template<UserDefinedTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(UserDefinedTypeFieldsClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
UserDefinedTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例11: testMessagePackableTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testMessagePackableTypeFieldsClassNotNullable(MessagePackableTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<MessagePackableTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(MessagePackableTypeFieldsClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
unpacker.resetReadByteCount();
MessagePackableTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例12: testPrimitiveTypeFieldsClass
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testPrimitiveTypeFieldsClass(PrimitiveTypeFieldsClass v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<PrimitiveTypeFieldsClass> tmpl = builder.buildTemplate(PrimitiveTypeFieldsClass.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
unpacker.resetReadByteCount();
unpacker.wrap(bytes);
PrimitiveTypeFieldsClass ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, unpacker.getReadByteCount());
}
示例13: testInheritanceClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testInheritanceClassNotNullable(InheritanceClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
Template<InheritanceClassNotNullable> tmpl = builder.buildTemplate(InheritanceClassNotNullable.class);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Packer packer = msgpack.createPacker(out);
tmpl.write(packer, v);
byte[] bytes = out.toByteArray();
BufferUnpacker u = msgpack.createBufferUnpacker();
u.resetReadByteCount();
u.wrap(bytes);
Value value = u.readValue();
Converter unpacker = new Converter(value);
InheritanceClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
}
示例14: testListTypeFieldsClassNotNullable
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testListTypeFieldsClassNotNullable(ListTypeFieldsClassNotNullable v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
ReflectionTemplateBuilder builder = new ReflectionTemplateBuilder(registry);
Template<ListTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(ListTypeFieldsClassNotNullable.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker u = msgpack.createBufferUnpacker();
u.resetReadByteCount();
u.wrap(bytes);
Value value = u.readValue();
Converter unpacker = new Converter(value);
ListTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, u.getReadByteCount());
}
示例15: testPrimitiveTypeFieldsClass
import org.msgpack.template.Template; //导入方法依赖的package包/类
@Override
public void testPrimitiveTypeFieldsClass(PrimitiveTypeFieldsClass v) throws Exception {
MessagePack msgpack = new MessagePack();
TemplateRegistry registry = new TemplateRegistry(null);
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
Template<PrimitiveTypeFieldsClass> tmpl = builder.buildTemplate(PrimitiveTypeFieldsClass.class);
BufferPacker packer = msgpack.createBufferPacker();
tmpl.write(packer, v);
byte[] bytes = packer.toByteArray();
BufferUnpacker u = msgpack.createBufferUnpacker();
u.resetReadByteCount();
u.wrap(bytes);
Value value = u.readValue();
Converter unpacker = new Converter(value);
PrimitiveTypeFieldsClass ret = tmpl.read(unpacker, null);
assertEquals(v, ret);
assertEquals(bytes.length, u.getReadByteCount());
}