当前位置: 首页>>代码示例>>Java>>正文


Java WritableUtils.writeVertexToDataOutput方法代码示例

本文整理汇总了Java中org.apache.giraph.utils.WritableUtils.writeVertexToDataOutput方法的典型用法代码示例。如果您正苦于以下问题:Java WritableUtils.writeVertexToDataOutput方法的具体用法?Java WritableUtils.writeVertexToDataOutput怎么用?Java WritableUtils.writeVertexToDataOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.giraph.utils.WritableUtils的用法示例。


在下文中一共展示了WritableUtils.writeVertexToDataOutput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
  output.writeInt(addedVertexList.size());
  for (Vertex<I, V, E> vertex : addedVertexList) {
    WritableUtils.writeVertexToDataOutput(output, vertex, getConf());
  }
  output.writeInt(removedVertexCount);
  output.writeInt(addedEdgeList.size());
  for (Edge<I, E> edge : addedEdgeList) {
    edge.getTargetVertexId().write(output);
    edge.getValue().write(output);
  }
  output.writeInt(removedEdgeList.size());
  for (I removedEdge : removedEdgeList) {
    removedEdge.write(output);
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:VertexMutations.java

示例2: write

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
  output.writeInt(addedVertexList.size());
  for (Vertex<I, V, E, M> vertex : addedVertexList) {
    WritableUtils.writeVertexToDataOutput(output, vertex, getConf());
  }
  output.writeInt(removedVertexCount);
  output.writeInt(addedEdgeList.size());
  for (Edge<I, E> edge : addedEdgeList) {
    edge.getTargetVertexId().write(output);
    edge.getValue().write(output);
  }
  output.writeInt(removedEdgeList.size());
  for (I removedEdge : removedEdgeList) {
    removedEdge.write(output);
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:18,代码来源:VertexMutations.java

示例3: write

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
  super.write(output);
  output.writeInt(vertexMap.size());
  for (Vertex<I, V, E> vertex : vertexMap.values()) {
    progress();
    WritableUtils.writeVertexToDataOutput(output, vertex, getConf());
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:10,代码来源:SimplePartition.java

示例4: write

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
@Override
public void write(DataOutput output) throws IOException {
  super.write(output);
  output.writeInt(vertexMap.size());
  for (Vertex<I, V, E, M> vertex : vertexMap.values()) {
    progress();
    WritableUtils.writeVertexToDataOutput(output, vertex, getConf());
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:10,代码来源:SimplePartition.java

示例5: testDynamicChannelBufferSerializeOutEdgesClass

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
private void testDynamicChannelBufferSerializeOutEdgesClass(
    Class<? extends OutEdges> edgesClass)
    throws IOException {
  Vertex<LongWritable, FloatWritable, DoubleWritable> vertex =
      buildVertex(edgesClass);

  long serializeNanosStart;
  long serializeNanos = 0;
  DynamicChannelBufferOutputStream outputStream = null;
  for (int i = 0; i <
      REPS; ++i) {
    serializeNanosStart = SystemTime.get().getNanoseconds();
    outputStream =
        new DynamicChannelBufferOutputStream(32);
    WritableUtils.writeVertexToDataOutput(outputStream, vertex, vertex.getConf());
    serializeNanos += Times.getNanosecondsSince(SystemTime.get(),
        serializeNanosStart);
  }
  serializeNanos /= REPS;
  System.out.println("testDynamicChannelBufferSerializeOutEdgesClass: " +
      "Serializing took " + serializeNanos + " ns for " +
      outputStream.getDynamicChannelBuffer().writerIndex() + " bytes " +
      (outputStream.getDynamicChannelBuffer().writerIndex() * 1f *
          Time.NS_PER_SECOND / serializeNanos) +
      " bytes / sec for " + edgesClass.getName());

  Vertex<LongWritable, FloatWritable, DoubleWritable>
      readVertex = buildVertex(edgesClass);

  long deserializeNanosStart;
  long deserializeNanos = 0;
  for (int i = 0; i < REPS; ++i) {
    deserializeNanosStart = SystemTime.get().getNanoseconds();
    DynamicChannelBufferInputStream inputStream = new
        DynamicChannelBufferInputStream(
        outputStream.getDynamicChannelBuffer());
    WritableUtils.reinitializeVertexFromDataInput(
        inputStream, readVertex, readVertex.getConf());
    deserializeNanos += Times.getNanosecondsSince(SystemTime.get(),
        deserializeNanosStart);
    outputStream.getDynamicChannelBuffer().readerIndex(0);
  }
  deserializeNanos /= REPS;
  System.out.println("testDynamicChannelBufferSerializeOutEdgesClass: " +
      "Deserializing took " + deserializeNanos + " ns for " +
      outputStream.getDynamicChannelBuffer().writerIndex() + " bytes " +
      (outputStream.getDynamicChannelBuffer().writerIndex() * 1f *
          Time.NS_PER_SECOND / deserializeNanos) +
      " bytes / sec for " + edgesClass.getName());

  assertEquals(vertex.getId(), readVertex.getId());
  assertEquals(vertex.getValue(), readVertex.getValue());
  assertTrue(EdgeIterables.sameEdges(vertex.getEdges(), readVertex.getEdges()));
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:55,代码来源:TestVertexAndEdges.java

示例6: testDynamicChannelBufferSerializeOutEdgesClass

import org.apache.giraph.utils.WritableUtils; //导入方法依赖的package包/类
private void testDynamicChannelBufferSerializeOutEdgesClass(
    Class<? extends OutEdges> edgesClass)
    throws IOException {
  Vertex<LongWritable, FloatWritable, DoubleWritable, LongWritable> vertex =
      buildVertex(edgesClass);

  long serializeNanosStart;
  long serializeNanos = 0;
  DynamicChannelBufferOutputStream outputStream = null;
  for (int i = 0; i <
      REPS; ++i) {
    serializeNanosStart = SystemTime.get().getNanoseconds();
    outputStream =
        new DynamicChannelBufferOutputStream(32);
    WritableUtils.writeVertexToDataOutput(outputStream, vertex, vertex.getConf());
    serializeNanos += Times.getNanosecondsSince(SystemTime.get(),
        serializeNanosStart);
  }
  serializeNanos /= REPS;
  System.out.println("testDynamicChannelBufferSerializeOutEdgesClass: " +
      "Serializing took " + serializeNanos + " ns for " +
      outputStream.getDynamicChannelBuffer().writerIndex() + " bytes " +
      (outputStream.getDynamicChannelBuffer().writerIndex() * 1f *
          Time.NS_PER_SECOND / serializeNanos) +
      " bytes / sec for " + edgesClass.getName());

  Vertex<LongWritable, FloatWritable, DoubleWritable, LongWritable>
      readVertex = buildVertex(edgesClass);

  long deserializeNanosStart;
  long deserializeNanos = 0;
  for (int i = 0; i < REPS; ++i) {
    deserializeNanosStart = SystemTime.get().getNanoseconds();
    DynamicChannelBufferInputStream inputStream = new
        DynamicChannelBufferInputStream(
        outputStream.getDynamicChannelBuffer());
    WritableUtils.reinitializeVertexFromDataInput(
        inputStream, readVertex, readVertex.getConf());
    deserializeNanos += Times.getNanosecondsSince(SystemTime.get(),
        deserializeNanosStart);
    outputStream.getDynamicChannelBuffer().readerIndex(0);
  }
  deserializeNanos /= REPS;
  System.out.println("testDynamicChannelBufferSerializeOutEdgesClass: " +
      "Deserializing took " + deserializeNanos + " ns for " +
      outputStream.getDynamicChannelBuffer().writerIndex() + " bytes " +
      (outputStream.getDynamicChannelBuffer().writerIndex() * 1f *
          Time.NS_PER_SECOND / deserializeNanos) +
      " bytes / sec for " + edgesClass.getName());

  assertEquals(vertex.getId(), readVertex.getId());
  assertEquals(vertex.getValue(), readVertex.getValue());
  assertTrue(EdgeIterables.sameEdges(vertex.getEdges(), readVertex.getEdges()));
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:55,代码来源:TestVertexAndEdges.java


注:本文中的org.apache.giraph.utils.WritableUtils.writeVertexToDataOutput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。