Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FSDataInputStream.readInt()


    postingsPath = env.getPostingsDirectory();

    FSDataInputStream posInput = fs.open(new Path(env
        .getPostingsIndexData()));

    int l = posInput.readInt();
    positions = new long[l];
    for (int i = 0; i < l; i++) {
      positions[i] = posInput.readLong();
      // sLogger.info(positions[i]);
    }
View Full Code Here


      }

      FSDataInputStream in = fs.open(restartFile);
      try {
        // read the old count
        restartCount = in.readInt();
        ++restartCount; // increment the restart count
      } catch (IOException ioe) {
        LOG.warn("System directory is garbled. Failed to read file "
                 + restartFile);
        LOG.warn("Jobtracker recovery is not possible with garbled"
View Full Code Here

        return;
      }

      FSDataInputStream in = fs.open(restartFile);
      // read the old count
      restartCount = in.readInt();
      ++restartCount; // increment the restart count
      in.close();

      // Write back the new restart count and rename the old info file
      //TODO This is similar to jobhistory recovery, maybe this common code
View Full Code Here

      }

      FSDataInputStream in = fs.open(restartFile);
      try {
        // read the old count
        restartCount = in.readInt();
        ++restartCount; // increment the restart count
      } catch (IOException ioe) {
        LOG.warn("System directory is garbled. Failed to read file "
                 + restartFile);
        LOG.warn("Jobtracker recovery is not possible with garbled"
View Full Code Here

  public static int readInt(Path path, Configuration configuration) throws IOException {
    FileSystem fs = FileSystem.get(path.toUri(), configuration);
    FSDataInputStream in = fs.open(path);
    try {
      return in.readInt();
    } finally {
      Closeables.close(in, true);
    }
  }
View Full Code Here

  private void prepareDocuments(String documentVectorClass, String documentsPath) throws Exception {
    documents = new HMapIV<DocumentVector>();

    FSDataInputStream input = fs.open(new Path(documentsPath));
    int docid = input.readInt();
    while(docid != -1) {
      documents.put(docid, DocumentVectorUtility.readInstance(documentVectorClass, input));
      docid = input.readInt();
    }
    input.close();
View Full Code Here

    FSDataInputStream input = fs.open(new Path(documentsPath));
    int docid = input.readInt();
    while(docid != -1) {
      documents.put(docid, DocumentVectorUtility.readInstance(documentVectorClass, input));
      docid = input.readInt();
    }
    input.close();
  }

  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
View Full Code Here

  private void prepareDocuments(String documentVectorClass, String documentsPath) throws Exception {
    documents = new HMapIV<DocumentVector>();

    FSDataInputStream input = fs.open(new Path(documentsPath));
    int docid = input.readInt();
    while(docid != -1) {
      documents.put(docid, DocumentVectorUtility.readInstance(documentVectorClass, input));
      docid = input.readInt();
    }
    input.close();
View Full Code Here

    FSDataInputStream input = fs.open(new Path(documentsPath));
    int docid = input.readInt();
    while(docid != -1) {
      documents.put(docid, DocumentVectorUtility.readInstance(documentVectorClass, input));
      docid = input.readInt();
    }
    input.close();
  }

  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
View Full Code Here

    postings = new HMapIV<CompressedPositionalPostings>();
    dfs = new HMapII();
    docLengths = new HMapII();

    FSDataInputStream input = fs.open(new Path(postingsPath));
    int termid = input.readInt();
    while(termid != -1) {
      dfs.put(termid, input.readInt());
      postings.put(termid, CompressedPositionalPostings.readInstance(input));
      termid = input.readInt();
    }
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.