Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
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();
 }