Package com.peterhi.io

Examples of com.peterhi.io.PmInputStream


  private PropModel read(RudpEvent event) throws IOException,
    ClassNotFoundException, PropException, IllegalAccessException,
    InstantiationException {
    InputStream stream = event.getInputStream();
   
    PmInputStream pis = new PmInputStream(stream);
    stream.mark(0);
    PropModel sink = pis.readModel();
    stream.reset();
    pis.close();
    return sink;
  }
View Full Code Here


  }
 
  private PropModel readModel(RudpEvent event) throws Exception {
    InputStream stream = event.getInputStream();
    stream.mark(0);
    PmInputStream pis = new PmInputStream(stream);
    PropModel model = pis.readModel();
    stream.reset();
    pis.close();
    return model;
  }
View Full Code Here

    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());
    Assert.assertEquals(p0.getShortValue(), p1.getShortValue());
View Full Code Here

    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());
    Assert.assertNull(bNull2.getShortObject());
View Full Code Here

TOP

Related Classes of com.peterhi.io.PmInputStream

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.