Package org.msgpack.packer

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


  MessagePack msgpack = new JSON();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
        if(((Double)v).isInfinite() || ((Double)v).isNaN()) {
            try {
                packer.writeDouble(v);
                fail("JSONPacker should reject infinite and NaN value");
            } catch (IOException ex) {
                assertTrue(ex instanceof IOException);
            }
            return;
View Full Code Here


            } catch (IOException ex) {
                assertTrue(ex instanceof IOException);
            }
            return;
        }
  packer.writeDouble(v);
  byte[] bytes = out.toByteArray();
  Unpacker unpacker = msgpack.createBufferUnpacker(bytes);
  double ret = unpacker.readDouble();
  assertEquals(v, ret, 10e-10);
    }
View Full Code Here

  MessagePack msgpack = new JSON();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
        if(((Double)v).isInfinite() || ((Double)v).isNaN()) {
            try {
                packer.writeDouble(v);
                fail("JSONPacker should reject infinite and NaN value");
            } catch (IOException ex) {
                assertTrue(ex instanceof IOException);
            }
            return;
View Full Code Here

            } catch (IOException ex) {
                assertTrue(ex instanceof IOException);
            }
            return;
        }
  packer.writeDouble(v);
  byte[] bytes = out.toByteArray();
  Unpacker unpacker = msgpack.createUnpacker(new ByteArrayInputStream(bytes));
  double ret = unpacker.readDouble();
  assertEquals(v, ret, 10e-10);
    }
View Full Code Here

    @Override
    public void testDouble(double v) throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeDouble(v);
  ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
  Unpacker unpacker = msgpack.createUnpacker(in);
  double ret = unpacker.readDouble();
  assertEquals(v, ret, 10e-10);
    }
View Full Code Here

    @Override
    public void testDouble(double v) throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeDouble(v);
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
  Value value = unpacker.readValue();
  assertTrue(value.isFloat());
  double ret = new Converter(value).readDouble();
View Full Code Here

    @Override
    public void testDouble(double v) throws Exception {
  MessagePack msgpack = new MessagePack();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Packer packer = msgpack.createPacker(out);
  packer.writeDouble(v);
  byte[] bytes = out.toByteArray();
  BufferUnpacker unpacker = msgpack.createBufferUnpacker(bytes);
  double ret = unpacker.readDouble();
  assertEquals(v, ret, 10e-10);
    }
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.