Package marauroa.common.net

Examples of marauroa.common.net.OutputSerializer


    return cache.get(this);
  }

  private byte[] getDynamicPartPerception(int protocolVersion) throws IOException {
    ByteArrayOutputStream array = new ByteArrayOutputStream();
    OutputSerializer serializer = new OutputSerializer(array);
    serializer.setProtocolVersion(protocolVersion);

    serializer.write(timestampPerception);
    if (myRPObjectModifiedAdded == null) {
      serializer.write((byte) 0);
    } else {
      serializer.write((byte) 1);
      myRPObjectModifiedAdded.writeObject(serializer, DetailLevel.PRIVATE);
    }

    if (myRPObjectModifiedDeleted == null) {
      serializer.write((byte) 0);
    } else {
      serializer.write((byte) 1);
      myRPObjectModifiedDeleted.writeObject(serializer, DetailLevel.PRIVATE);
    }

    return array.toByteArray();
  }
View Full Code Here


      if (!cachedContent.containsKey(key)) {
        logger.debug("Perception not found in cache");
        ByteArrayOutputStream array = new ByteArrayOutputStream();
        DeflaterOutputStream out_stream = new DeflaterOutputStream(array);
        OutputSerializer serializer = new OutputSerializer(out_stream);
        serializer.setProtocolVersion(perception.getProtocolVersion());

        perception.computeStaticPartPerception(serializer);
        out_stream.close();
        byte[] content = array.toByteArray();
View Full Code Here

  public void writeObject(marauroa.common.net.OutputSerializer out) throws IOException {
    super.writeObject(out);

    ByteArrayOutputStream array = new ByteArrayOutputStream();
    DeflaterOutputStream out_stream = new DeflaterOutputStream(array);
    OutputSerializer serializer = new OutputSerializer(out_stream);
    serializer.setProtocolVersion(out.getProtocolVersion());

    int size = contents.size();
    serializer.write(size);

    for (TransferContent content : contents) {
      content.writeFULL(serializer);
    }
View Full Code Here

        expected.add(DefinitionClass.ATTRIBUTE, "b", Type.FLAG, Definition.HIDDEN);
        expected.add(DefinitionClass.ATTRIBUTE, "c", Type.STRING, (byte) (Definition.PRIVATE | Definition.VOLATILE));
        expected.add(DefinitionClass.RPSLOT, "d", 1, Definition.HIDDEN);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        OutputSerializer os = new OutputSerializer(out);

        os.write(expected);

        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        InputSerializer is = new InputSerializer(in);

        RPClass result = (RPClass) is.readObject(new RPClass());
View Full Code Here

    RPEvent expected = new RPEvent("test");
    expected.put("value", "work!");
    expected.setOwner(obj);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(expected);

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InputSerializer is = new InputSerializer(in);

    RPEvent result = (RPEvent) is.readObject(new RPEvent());
View Full Code Here

    RPEvent expected = new RPEvent("test");
    expected.put("value", "work!");
    expected.setOwner(obj);

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(expected);

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InputSerializer is = new InputSerializer(in);

    RPEvent result = new RPEvent();
View Full Code Here

    attr.put("b", "2");
    attr.put("c", 3.0);
    attr.put("e", "a short string");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(attr);

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InputSerializer is = new InputSerializer(in);

    Attributes result = (Attributes) is.readObject(new Attributes(null));
View Full Code Here

                    "This is a loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong stream but it think we can make even longer with a biiiiiiiiiiiiiiiiiiiiiiiiiiiiiiit of heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp frooooooooooooooooooooooooooom users all around the world");
    attr.put("g", "Toooooooo big to even test the limit");
    attr.put("h", "");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(attr);

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InputSerializer is = new InputSerializer(in);

    Attributes result = (Attributes) is.readObject(new Attributes(null));
View Full Code Here

                    "This is a loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong stream but it think we can make even longer with a biiiiiiiiiiiiiiiiiiiiiiiiiiiiiiit of heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp frooooooooooooooooooooooooooom users all around the world");
    attr.put("g", "Toooooooo big to even test the limit");
    attr.put("h", "");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(attr);

    ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
    InputSerializer is = new InputSerializer(in);

    Attributes result = (Attributes) is.readObject(new Attributes(null));
View Full Code Here

        "of 256 bytes for short strings, we need a way to test it.");
    System.out.println(attr.get("d").length());
    attr.put("e", "a short string");

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    OutputSerializer os = new OutputSerializer(out);

    os.write(attr);
  }
View Full Code Here

TOP

Related Classes of marauroa.common.net.OutputSerializer

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.