Examples of wrapAsByteBuffer()


Examples of eu.stratosphere.runtime.io.serialization.DataOutputSerializer.wrapAsByteBuffer()

      for (AbstractEvent evt : events) {
        serializer.writeUTF(evt.getClass().getName());
        evt.write(serializer);
      }

      return serializer.wrapAsByteBuffer();
    }
    catch (IOException e) {
      throw new RuntimeException("Error while serializing the task events.", e);
    }
  }
View Full Code Here

Examples of eu.stratosphere.runtime.io.serialization.DataOutputSerializer.wrapAsByteBuffer()

      // Write out the ConnectionHeader
      DataOutputSerializer buf = new DataOutputSerializer(4 + header.getProtocol().getBytes().length + 1);
      header.write(buf);

      // Write out the payload length
      ByteBuffer wrapper = buf.wrapAsByteBuffer();
      int bufLen = wrapper.limit();
      out.writeInt(bufLen);
      out.write(wrapper.array(), 0, bufLen);
    }
View Full Code Here

Examples of eu.stratosphere.runtime.io.serialization.DataOutputSerializer.wrapAsByteBuffer()

          // First, write call id to buffer d
          d.writeInt(call.id);
          // Then write RPC data (the actual call) to buffer d
          call.param.write(d);

          ByteBuffer wrapper = d.wrapAsByteBuffer();
          byte[] data = wrapper.array();
          int dataLength = wrapper.limit();
          out.writeInt(dataLength); // first put the data length
          out.write(data, 0, dataLength);// write the data
          out.flush();
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

      for (AbstractEvent evt : events) {
        serializer.writeUTF(evt.getClass().getName());
        evt.write(serializer);
      }

      return serializer.wrapAsByteBuffer();
    }
    catch (IOException e) {
      throw new RuntimeException("Error while serializing the task events.", e);
    }
  }
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

    DataOutputSerializer serializer = new DataOutputSerializer(randomInt.length());
    MemorySegment segment = new MemorySegment(new byte[randomInt.length()]);

    try {
      // empty buffer, read buffer should be empty
      ByteBuffer wrapper = serializer.wrapAsByteBuffer();

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(0, wrapper.limit());

      // write to data output, read buffer should still be empty
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(0, wrapper.limit());

      // get updated read buffer, read buffer should contain written data
      wrapper = serializer.wrapAsByteBuffer();

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(randomInt.length(), wrapper.limit());

      // clear data output, read buffer should still contain written data
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(randomInt.length(), wrapper.limit());

      // get updated read buffer, should be empty
      wrapper = serializer.wrapAsByteBuffer();

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(0, wrapper.limit());

      // write to data output and read back to memory
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

      Assert.assertEquals(0, wrapper.position());
      Assert.assertEquals(0, wrapper.limit());

      // write to data output and read back to memory
      randomInt.write(serializer);
      wrapper = serializer.wrapAsByteBuffer();

      segment.put(0, wrapper, randomInt.length());

      Assert.assertEquals(randomInt.length(), wrapper.position());
      Assert.assertEquals(randomInt.length(), wrapper.limit());
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

        e.printStackTrace();
        Assert.fail("Test encountered an unexpected exception.");
      }
    }

    DataInputDeserializer deserializer = new DataInputDeserializer(serializer.wrapAsByteBuffer());

    for (SerializationTestType expected : reference) {
      try {
        SerializationTestType actual = expected.getClass().newInstance();
        actual.read(deserializer);
View Full Code Here

Examples of org.apache.flink.runtime.io.network.serialization.DataOutputSerializer.wrapAsByteBuffer()

    DataOutputSerializer out = new DataOutputSerializer(64);
   
    UID id = new UID(3);
    id.write(out);

    ByteBuffer buff = out.wrapAsByteBuffer();

   
    DataInputDeserializer in = new DataInputDeserializer(buff);
   
    UID id2 = new UID();
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.