Examples of writeNil()


Examples of org.msgpack.packer.Packer.writeNil()

    public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
  MessagePack msgpack = new JSON();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  if (v == null) {
      packer.writeNil();
  } else {
      packer.writeMapBegin(v.size());
      for (Map.Entry<Object, Object> e : ((Map<Object, Object>) v).entrySet()) {
    if (!(e.getKey() instanceof String)) {
        try {
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    @Test @Override
    public void testNil() throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeNil();
  ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
  Unpacker unpacker = msgpack.createUnpacker(in);
  unpacker.readNil();
    }
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <E> void testList(List<E> v, Class<E> elementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
        if (v == null) {
            packer.writeNil();
        } else {
            packer.writeArrayBegin(v.size());
            for (Object o : v) {
          packer.write(o);
            }
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  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());
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    @Test @Override
    public void testNil() throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeNil();
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
  Value value = unpacker.readValue();
  assertTrue(value.isNil());
  new Converter(value).readNil();
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <E> void testList(List<E> v, Class<E> elementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
        if (v == null) {
            packer.writeNil();
        } else {
            packer.writeArrayBegin(v.size());
            for (Object o : v) {
          packer.write(o);
            }
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  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());
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    @Test @Override
    public void testNil() throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeNil();
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
  unpacker.readNil();
    }
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <E> void testList(List<E> v, Class<E> elementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
        if (v == null) {
            packer.writeNil();
        } else {
            packer.writeArrayBegin(v.size());
            for (Object o : v) {
          packer.write(o);
            }
View Full Code Here

Examples of org.msgpack.packer.Packer.writeNil()

    public <K, V> void testMap(Map<K, V> v, Class<K> keyElementClass, Class<V> valueElementClass) throws Exception {
      MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  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());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.