Coverage Report - org.galagosearch.core.index.GenericElement
 
Classes in this File Line Coverage Branch Coverage Complexity
GenericElement
75%
12/16
N/A
1
 
 1  
 /*
 2  
  * To change this template, choose Tools | Templates
 3  
  * and open the template in the editor.
 4  
  */
 5  
 
 6  
 package org.galagosearch.core.index;
 7  
 
 8  
 import java.io.IOException;
 9  
 import java.io.OutputStream;
 10  
 import org.galagosearch.tupleflow.Utility;
 11  
 
 12  
 /**
 13  
  *
 14  
  * @author trevor
 15  
  */
 16  
 public class GenericElement implements IndexElement {
 17  
     byte[] key;
 18  
     byte[] data;
 19  
 
 20  0
     public GenericElement(byte[] key, byte[] data) {
 21  0
         this.key = key;
 22  0
         this.data = data;
 23  0
     }
 24  
     
 25  12
     public GenericElement(String key, byte[] data) {
 26  12
         this.key = Utility.makeBytes(key);
 27  12
         this.data = data;
 28  12
     }
 29  
     
 30  8016
     public GenericElement(String key, String value) {
 31  8016
         this.key = Utility.makeBytes(key);
 32  8016
         this.data = Utility.makeBytes(value);
 33  8016
     }
 34  
 
 35  
     public byte[] key() {
 36  48148
         return key;
 37  
     }
 38  
 
 39  
     public long dataLength() {
 40  40140
         return data.length;
 41  
     }
 42  
 
 43  
     public void write(OutputStream stream) throws IOException {
 44  8028
         stream.write(data);
 45  8028
     }
 46  
 }