本文整理汇总了Java中org.msgpack.unpacker.Converter.readValue方法的典型用法代码示例。如果您正苦于以下问题:Java Converter.readValue方法的具体用法?Java Converter.readValue怎么用?Java Converter.readValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.msgpack.unpacker.Converter
的用法示例。
在下文中一共展示了Converter.readValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testList
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public <E> void testList(List<E> v, Class<E> elementClass) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
if (v == null) {
packer.writeNil();
} else {
packer.writeArrayBegin(v.size());
for (Object o : v) {
packer.write(o);
}
packer.writeArrayEnd();
}
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
if (unpacker.trySkipNil()) {
assertEquals(null, v);
return;
}
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例2: testMap
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
if (v == null) {
packer.writeNil();
} else {
packer.writeMapBegin(v.size());
for (Map.Entry<K, V> e : ((Map<K, V>) v).entrySet()) {
packer.write(e.getKey());
packer.write(e.getValue());
}
packer.writeMapEnd();
}
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
if (unpacker.trySkipNil()) {
assertEquals(null, v);
return;
}
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例3: testBoolean
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testBoolean(boolean v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例4: testByte
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testByte(byte v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例5: testShort
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testShort(short v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例6: testInteger
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testInteger(int v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例7: testLong
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testLong(long v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例8: testFloat
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testFloat(float v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例9: testDouble
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testDouble(double v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例10: testBigInteger
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testBigInteger(BigInteger v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例11: testString
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testString(String v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}
示例12: testByteArray
import org.msgpack.unpacker.Converter; //导入方法依赖的package包/类
@Override
public void testByteArray(byte[] v) throws Exception {
MessagePack msgpack = new MessagePack();
Unconverter packer = new Unconverter(msgpack);
packer.write(v);
Value r = packer.getResult();
Converter unpacker = new Converter(msgpack, r);
Value ret = unpacker.readValue();
assertEquals(r, ret);
}