Package org.msgpack.type

Examples of org.msgpack.type.MapValue


    public int readMapBegin() {
        Value v = getTop();
        if(!v.isMap()) {
            throw new MessageTypeException("Expected map but got not map value");
        }
        MapValue m = v.asMapValue();
        stack.reduceCount();
        stack.pushMap(m.size());
        values[stack.getDepth()] = m.getKeyValueArray();
        return m.size();
    }
View Full Code Here


                stack.reduceCount();
                stack.pushArray(a.size());
                values[stack.getDepth()] = a.getElementArray();

            } else if(v.isMap()) {
                MapValue m = v.asMapValue();
                uc.writeMapBegin(m.size());
                stack.reduceCount();
                stack.pushMap(m.size());
                values[stack.getDepth()] = m.getKeyValueArray();

            } else {
                uc.write(v);
                stack.reduceCount();
            }
View Full Code Here

                stack.reduceCount();
                stack.pushArray(a.size());
                values[stack.getDepth()] = a.getElementArray();

            } else if(v.isMap()) {
                MapValue m = v.asMapValue();
                stack.reduceCount();
                stack.pushMap(m.size());
                values[stack.getDepth()] = m.getKeyValueArray();

            } else {
                stack.reduceCount();
            }
        }
View Full Code Here

    return sparsePacker.getResult();
  }

  protected void recursiveWrite(Value value) throws IOException {
    if (value.isMapValue()) {
      MapValue map = value.asMapValue();
      int newLength = 0;
      for (Map.Entry<Value, Value> entry : map.entrySet()) {
        if (!entry.getValue().isNilValue()) {
          ++newLength;
        }
      }
      sparsePacker.writeMapBegin(newLength);
      for (Map.Entry<Value, Value> entry : map.entrySet()) {
        if (!entry.getValue().isNilValue()) {
          sparsePacker.write(entry.getKey());
          recursiveWrite(entry.getValue());
        }
      }
View Full Code Here

        Assert.assertTrue(unpackedMap.containsKey("y"));
        Assert.assertTrue(unpackedMap.containsKey("z"));
        Assert.assertEquals("x", unpackedMap.get("x").asRawValue().getString());
        Assert.assertEquals("some", unpackedMap.get("y").asRawValue().getString());

        MapValue mapValue = unpackedMap.get("z").asMapValue();
        Map innerMapValue = new Converter(mapValue).read(tMap(TString, TString));
        Assert.assertNotNull(innerMapValue);
        Assert.assertEquals("b", innerMapValue.get("a"));
    }
View Full Code Here

                final Object val = deserializeObject(src.get(i));
                dst.add(i, val);
            }
            o = dst;
        } else if (v.isMapValue()) {
            final MapValue src = v.asMapValue();
            final HashMap<Object, Object> dst = new HashMap<Object, Object>(src.size());
            for (Map.Entry<Value, Value> entry : src.entrySet()) {
                final Object key = deserializeObject(entry.getKey());
                final Object val = deserializeObject(entry.getValue());
                dst.put(key, val);
            }
            o = dst;
View Full Code Here

TOP

Related Classes of org.msgpack.type.MapValue

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.