Package org.msgpack.packer

Examples of org.msgpack.packer.Packer


  @Override
  public void testLongArray(long[] v) throws Exception {
      MessagePack msgpack = new MessagePack();
      Template<long[]> tmpl = LongArrayTemplate.instance;
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
      long[] ret0;
      switch (index) {
View Full Code Here


      MessagePack msgpack = new MessagePack();
      Template<K> keyElementTemplate = msgpack.lookup(keyElementClass);
      Template<V> valueElementTemplate = msgpack.lookup(valueElementClass);
      Template<Map<K, V>> tmpl = new MapTemplate(keyElementTemplate, valueElementTemplate);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
      Map<K, V> ret = tmpl.read(unpacker, null);
      assertEquals(v, ret);
View Full Code Here

      MessagePack msgpack = new MessagePack();
      Template<K> keyElementTemplate = msgpack.lookup(keyElementClass);
      Template<V> valueElementTemplate = msgpack.lookup(valueElementClass);
      Template<Map<K, V>> tmpl = new MapTemplate(keyElementTemplate, valueElementTemplate);
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
      Map<K, V> ret = tmpl.read(unpacker, null);
      assertEquals(v, ret);
View Full Code Here

  @Override
  public void testIntegerArray(int[] v) throws Exception {
      MessagePack msgpack = new MessagePack();
      Template<int[]> tmpl = IntegerArrayTemplate.instance;
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
      int[] ret0;
      switch (index) {
View Full Code Here

  @Override
  public void testIntegerArray(int[] v) throws Exception {
      MessagePack msgpack = new MessagePack();
      Template<int[]> tmpl = IntegerArrayTemplate.instance;
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
      int[] ret0;
      switch (index) {
View Full Code Here

  @Override
  public void testBoolean(boolean v) throws Exception {
      MessagePack msgpack = new MessagePack();
      Template<Boolean> tmpl = BooleanTemplate.instance;
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
      boolean ret = tmpl.read(unpacker, null);
      assertEquals(v, ret);
View Full Code Here

  @Override
  public void testBoolean(boolean v) throws Exception {
      MessagePack msgpack = new MessagePack();
      Template<Boolean> tmpl = BooleanTemplate.instance;
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      Packer packer = msgpack.createPacker(out);
      tmpl.write(packer, v);
      byte[] bytes = out.toByteArray();
      BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
      boolean ret = tmpl.read(unpacker, null);
      assertEquals(v, ret);
View Full Code Here

  MessagePack msgpack = new MessagePack();
  TemplateRegistry registry = new TemplateRegistry();
  JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
  Template<PrimitiveTypeFieldsClass> tmpl = builder.buildTemplate(PrimitiveTypeFieldsClass.class);
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  tmpl.write(packer, v);
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker();
  unpacker.wrap(bytes);
  PrimitiveTypeFieldsClass ret = tmpl.read(unpacker, null);
View Full Code Here

  MessagePack msgpack = new MessagePack();
  TemplateRegistry registry = new TemplateRegistry();
  JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
  Template<PrimitiveTypeFieldsClassNotNullable> tmpl = builder.buildTemplate(PrimitiveTypeFieldsClassNotNullable.class);
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  tmpl.write(packer, v);
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker();
  unpacker.wrap(bytes);
  PrimitiveTypeFieldsClassNotNullable ret = tmpl.read(unpacker, null);
View Full Code Here

  MessagePack msgpack = new MessagePack();
  TemplateRegistry registry = new TemplateRegistry();
  JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
  Template<ReferenceTypeFieldsClass> tmpl = builder.buildTemplate(ReferenceTypeFieldsClass.class);
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  tmpl.write(packer, v);
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker();
  unpacker.wrap(bytes);
  ReferenceTypeFieldsClass ret = tmpl.read(unpacker, null);
View Full Code Here

TOP

Related Classes of org.msgpack.packer.Packer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.