Package eu.stratosphere.runtime.io.serialization

Examples of eu.stratosphere.runtime.io.serialization.DataOutputSerializer


  }

  private ByteBuffer serializeEvents(List<? extends AbstractEvent> events) {
    try {
      // create the serialized event list
      DataOutputSerializer serializer = events.size() == 0
        ? new DataOutputSerializer(4)
        : new DataOutputSerializer(events.size() * 32);
      serializer.writeInt(events.size());

      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


    private void writeHeader() throws IOException {
      // Write out the header and version
      out.write(Server.HEADER.array());

      // 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

    public void sendParam(Call call) {
      if (shouldCloseConnection.get()) {
        return;
      }

      DataOutputSerializer d = null;
      try {
        synchronized (this.out) {

          // for serializing the
          // data to be written
          d = new DataOutputSerializer(64);
          // 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

TOP

Related Classes of eu.stratosphere.runtime.io.serialization.DataOutputSerializer

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.