Package org.msgpack.unpacker

Examples of org.msgpack.unpacker.Converter


  }

  Unconverter unconverter = new Unconverter(msgpack);
  unconverter.write(t);
  Value value = unconverter.getResult();
  Converter converter = new Converter(msgpack, value);
  GenericsTest c = converter.read(GenericsTest.class);
  assertEquals(t.slist.length, c.slist.length);
  for (int i = 0; i < t.slist.length; i++) {
      assertEquals(t.slist[i].size(), c.slist[i].size());
      for (int j = 0; j < t.slist[i].size(); j++) {
    assertEquals(t.slist[i].get(j), c.slist[i].get(j));
View Full Code Here


  }

  Unconverter unconverter = new Unconverter(msgpack);
  unconverter.write(src);
  Value value = unconverter.getResult();
  Converter converter = new Converter(msgpack, value);
  int[][][] c = converter.read(int[][][].class);
  assertEquals(src.length, c.length);
  for (int i = 0; i < src.length; ++i) {
      assertEquals(src[i].length, c[i].length);
      for (int j = 0; j < src[i].length; ++j) {
    assertEquals(src[i][j].length, c[i][j].length);
View Full Code Here

        return tmpl.read(createUnpacker(in), null);
    }

    public <T> T convert(Value v, T to) throws IOException // TODO IOException
        Template<T> tmpl = registry.lookup(to.getClass());
        return tmpl.read(new Converter(this, v), to);
    }
View Full Code Here

        return tmpl.read(new Converter(this, v), to);
    }

    public <T> T convert(Value v, Class<T> c) throws IOException {
        Template<T> tmpl = registry.lookup(c);
        return tmpl.read(new Converter(this, v), null);
    }
View Full Code Here

    public void testBoolean(boolean v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeBoolean(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
        assertEquals(r, ret);
    }
View Full Code Here

    public void testByte(byte v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeByte(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
        assertEquals(r, ret);
    }
View Full Code Here

    public void testShort(short v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeShort(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
        assertEquals(r, ret);
    }
View Full Code Here

    public void testInteger(int v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeInt(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
        assertEquals(r, ret);
    }
View Full Code Here

    public void testLong(long v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeLong(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
        assertEquals(r, ret);
    }
View Full Code Here

    public void testFloat(float v) throws Exception {
  MessagePack msgpack = new MessagePack();
        Unconverter packer = new Unconverter(msgpack);
        packer.writeFloat(v);
        Value r = packer.getResult();
        Converter unpacker = new Converter(msgpack, r);
        Value ret = unpacker.readValue();
  assertEquals(r, ret);
    }
View Full Code Here

TOP

Related Classes of org.msgpack.unpacker.Converter

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.