コード例 #1
0
 @Override
 public Edge<I, E> next() {
   try {
     WritableUtils.readEdge(extendedDataInput, representativeEdge);
   } catch (IOException e) {
     throw new IllegalStateException(
         "next: Failed on pos " + extendedDataInput.getPos() + " edge " + representativeEdge);
   }
   return representativeEdge;
 }
コード例 #2
0
 @Override
 public void add(Edge<I, E> edge) {
   ExtendedDataOutput extendedDataOutput =
       getConf().createExtendedDataOutput(serializedEdges, serializedEdgesBytesUsed);
   try {
     WritableUtils.writeEdge(extendedDataOutput, edge);
   } catch (IOException e) {
     throw new IllegalStateException("add: Failed to write to the new " + "byte array");
   }
   serializedEdges = extendedDataOutput.getByteArray();
   serializedEdgesBytesUsed = extendedDataOutput.getPos();
   ++edgeCount;
 }
コード例 #3
0
 @Override
 public void initialize(Iterable<Edge<I, E>> edges) {
   ExtendedDataOutput extendedOutputStream = getConf().createExtendedDataOutput();
   for (Edge<I, E> edge : edges) {
     try {
       WritableUtils.writeEdge(extendedOutputStream, edge);
     } catch (IOException e) {
       throw new IllegalStateException("initialize: Failed to serialize " + edge);
     }
     ++edgeCount;
   }
   serializedEdges = extendedOutputStream.getByteArray();
   serializedEdgesBytesUsed = extendedOutputStream.getPos();
 }
コード例 #4
0
 @Override
 public void readFields(DataInput input) throws IOException {
   computationClass = WritableUtils.readClass(input);
   incomingMessageClasses = WritableUtils.readWritableObject(input, conf);
   outgoingMessageClasses = WritableUtils.readWritableObject(input, conf);
 }
コード例 #5
0
 @Override
 public void write(DataOutput output) throws IOException {
   WritableUtils.writeClass(computationClass, output);
   WritableUtils.writeWritableObject(incomingMessageClasses, output);
   WritableUtils.writeWritableObject(outgoingMessageClasses, output);
 }