Examples of readFields()


Examples of org.apache.mahout.clustering.iterator.ClusteringPolicyWritable.readFields()

  public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    modelClass = in.readUTF();
    models = Lists.newArrayList();
    ClusteringPolicyWritable clusteringPolicyWritable = new ClusteringPolicyWritable();
    clusteringPolicyWritable.readFields(in);
    policy = clusteringPolicyWritable.getValue();
    for (int i = 0; i < size; i++) {
      Cluster element = ClassUtils.instantiateAs(modelClass, Cluster.class);
      element.readFields(in);
      models.add(element);
View Full Code Here

Examples of org.apache.mahout.math.MatrixWritable.readFields()

        if (!fs.exists(inverseCovarianceFile.get())) {
          throw new FileNotFoundException(inverseCovarianceFile.get().toString());
        }
        DataInputStream in = fs.open(inverseCovarianceFile.get());
        try {
          inverseCovarianceMatrix.readFields(in);
        } finally {
          in.close();
        }
        this.inverseCovarianceMatrix = inverseCovarianceMatrix.get();
      }
View Full Code Here

Examples of org.apache.mahout.math.VectorWritable.readFields()

        if (!fs.exists(weightsFile.get())) {
          throw new FileNotFoundException(weightsFile.get().toString());
        }
        DataInputStream in = fs.open(weightsFile.get());
        try {
          weights.readFields(in);
        } finally {
          in.close();
        }
        this.weights = weights.get();
      }
View Full Code Here

Examples of org.apache.mahout.matrix.Vector.readFields()

        if (!fs.exists(weightsFile.get())) {
          throw new FileNotFoundException(weightsFile.get().toString());
        }
        DataInputStream in = fs.open(weightsFile.get());
        try {
          weights.readFields(in);
        } finally {
          in.close();
        }
        this.weights = weights;
      }
View Full Code Here

Examples of org.apache.nutch.crawl.MapWritable.readFields()

    assertEquals(writable.get(key1), value);
    assertEquals(writable.get(key2), value);

    DataInputBuffer dib = new DataInputBuffer();
    dib.reset(dob.getData(), dob.getLength());
    writable.readFields(dib);
    assertEquals(writable.get(key1), value);
    assertNull(writable.get(key2));
  }

  public static void main(String[] args) throws Exception {
View Full Code Here

Examples of org.apache.nutch.crawl.UrlWithScore.readFields()

    // read from in
    UrlWithScore keyIn = new UrlWithScore();
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    DataInputStream in = new DataInputStream(bis);
    keyIn.readFields(in);
    assertEquals(keyOut.getUrl().toString(), keyIn.getUrl().toString());
    assertEquals(keyOut.getScore().get(), keyIn.getScore().get(), 0.001);

    in.close();
    out.close();
View Full Code Here

Examples of org.apache.nutch.indexer.NutchDocument.readFields()

  }

  public void readFields(DataInput in) throws IOException {
    action = in.readByte();
    NutchDocument doc = new NutchDocument();
    doc.readFields(in);
  }

  public void write(DataOutput out) throws IOException {
    out.write(action);
    doc.write(out);
View Full Code Here

Examples of org.apache.nutch.io.UTF8.readFields()

          Call call = (Call)calls.remove(new Integer(id));
          boolean isError = in.readBoolean();     // read if error
          if (isError) {
            UTF8 utf8 = new UTF8();
            utf8.readFields(in);                  // read error string
            call.error = utf8.toString();
            call.value = null;
          } else {
            Writable value = makeValue();
            value.readFields(in);                 // read value
View Full Code Here

Examples of org.apache.nutch.io.WritableComparable.readFields()

      try {
        sortValue = (WritableComparable)sortClass.newInstance();
      } catch (Exception e) {
        throw new IOException(e.toString());
      }
      sortValue.readFields(in);                   // read sortValue

      String dedupValue = UTF8.readString(in);    // read dedupValue

      top[i] = new Hit(indexDocNo, sortValue, dedupValue);
    }
View Full Code Here

Examples of org.apache.nutch.metadata.Metadata.readFields()

  private Metadata writeRead(Metadata meta) {
    Metadata readed = new Metadata();
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      meta.write(new DataOutputStream(out));
      readed.readFields(new DataInputStream(new ByteArrayInputStream(out.toByteArray())));
    } catch (IOException ioe) {
      fail(ioe.toString());
    }
    return readed;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.