Examples of PmOutputStream


Examples of com.peterhi.io.PmOutputStream

    final boolean reliable) {
    threadPool.submit(new Run<Void>() {
      @Override
      protected void onRun() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PmOutputStream pos = new PmOutputStream(baos);
        pos.writeModel(sink);
        byte[] bytes = baos.toByteArray();
        server.send(address, bytes, 0, bytes.length, reliable);
        pos.close();
      }
    }.asRunnable());
  }
View Full Code Here

Examples of com.peterhi.io.PmOutputStream

  }
 
  private void doWriteModel(SocketAddress address, PropModel model)
    throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PmOutputStream pos = new PmOutputStream(baos);
    pos.writeModel(model);
    byte[] buffer = baos.toByteArray();
    server.send(address, buffer, 0, buffer.length, true);
    pos.close();
  }
View Full Code Here

Examples of com.peterhi.io.PmOutputStream

      PropUtil.getValue(p0, "intxValue"));
    Assert.assertEquals(new uintx(uintx.MAX_62),
      PropUtil.getValue(p0, "uintxValue"));
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PmOutputStream pos = new PmOutputStream(baos);
    pos.writeModel(p0);
   
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    PmInputStream pis = new PmInputStream(bais);
    Primitives p1 = pis.readModel();
   
    Assert.assertEquals(0, pis.available());
    pos.close();
    pis.close();
   
    Assert.assertEquals(p0.isBooleanValue(), p1.isBooleanValue());
    Assert.assertEquals(p0.getByteValue(), p1.getByteValue());
    Assert.assertEquals(p0.getCharValue(), p1.getCharValue());
View Full Code Here

Examples of com.peterhi.io.PmOutputStream

    b0.setLongObject(Long.MAX_VALUE);
    b0.setFloatObject(Float.MAX_VALUE);
    b0.setDoubleObject(Double.MAX_VALUE);
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PmOutputStream pos = new PmOutputStream(baos);
    pos.writeModel(bNull);
    pos.writeModel(b0);
   
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    PmInputStream pis = new PmInputStream(bais);
    Boxers bNull2 = pis.readModel();
    Boxers b1 = pis.readModel();
   
    Assert.assertEquals(0, pis.available());
    pos.close();
    pis.close();
   
    Assert.assertNull(bNull2.getBooleanObject());
    Assert.assertNull(bNull2.getByteObject());
    Assert.assertNull(bNull2.getCharacterObject());
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.