Coverage Report - org.apache.giraph.utils.RepresentativeByteStructIterator
 
Classes in this File Line Coverage Branch Coverage Complexity
RepresentativeByteStructIterator
0%
0/9
N/A
2
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.giraph.utils;
 19  
 
 20  
 import java.io.IOException;
 21  
 import org.apache.hadoop.io.Writable;
 22  
 
 23  
 /**
 24  
  * The objects provided by this iterator have lifetimes only until next() is
 25  
  * called.  In that sense, the object provided is only a representative object.
 26  
  *
 27  
  * @param <T> Type that extends Writable that will be iterated
 28  
  */
 29  0
 public abstract class RepresentativeByteStructIterator<T extends
 30  
     Writable> extends ByteStructIterator<T> {
 31  
   /** Representative writable */
 32  0
   private final T representativeWritable = createWritable();
 33  
 
 34  
   /**
 35  
    * Wrap ExtendedDataInput in ByteArrayIterator
 36  
    *
 37  
    * @param extendedDataInput ExtendedDataInput
 38  
    */
 39  
   public RepresentativeByteStructIterator(ExtendedDataInput extendedDataInput) {
 40  0
     super(extendedDataInput);
 41  0
   }
 42  
 
 43  
   @Override
 44  
   public T next() {
 45  
     try {
 46  0
       representativeWritable.readFields(extendedDataInput);
 47  0
     } catch (IOException e) {
 48  0
       throw new IllegalStateException("next: readFields got IOException", e);
 49  0
     }
 50  0
     return representativeWritable;
 51  
   }
 52  
 }