Package org.apache.hadoop.fs

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


    mTerms = new String[mNumTerms];
    mDfs = new int[mNumTerms];

    for (int i = 0; i < mNumTerms; i++) {
      String term = in.readUTF();

      //changed by Ferhan Ture : df table isn't read properly with commented line
      //int df = WritableUtils.readVInt(in);
      int df = in.readInt();
View Full Code Here


    Path idPath = new Path(rootdir, HConstants.CLUSTER_ID_FILE_NAME);
    String clusterId = null;
    if (fs.exists(idPath)) {
      FSDataInputStream in = fs.open(idPath);
      try {
        clusterId = in.readUTF();
      } catch (EOFException eof) {
        LOG.warn("Cluster ID file "+idPath.toString()+" was empty");
      } finally{
        in.close();
      }
View Full Code Here

      }

      // load document forward index
      if (findexPath != null) {
        FSDataInputStream in = fs.open(new Path(findexPath));
        String indexClass = in.readUTF();
        in.close();

        try {
          mForwardIndex = (DocumentForwardIndex<Indexable>) Class.forName(indexClass)
          .newInstance();
View Full Code Here

    mTerms = new String[mNumTerms];
    mDfs = new int[mNumTerms];

    for (int i = 0; i < mNumTerms; i++) {
      String term = in.readUTF();
     
      //changed by Ferhan Ture : df table isn't read properly with commented line
      //int df = WritableUtils.readVInt(in);
      int df = in.readInt();
     
View Full Code Here

    dos.writeUTF(STRING);
    dos.close();

    // reading
    FSDataInputStream dis = hdfs.open(path);
    String s = dis.readUTF();
    System.out.println(s);
    assertEquals(STRING, s);

    dis.close();
View Full Code Here

          Path path = new Path(checkpointPath(superstepProgress));
          FSDataInputStream in = this.fs.open(path);
          BSPMessageBundle<M> bundle = new BSPMessageBundle<M>();
          try {
            for (int i = 0; i < numMessages; ++i) {
              String className = in.readUTF();
              @SuppressWarnings("unchecked")
              M message = (M) ReflectionUtils.newInstance(
                  Class.forName(className), conf);
              message.readFields(in);
              bundle.addMessage(message);
View Full Code Here

    // Checking the messages for superstep 2 and peer id 1
    String expectedPath = "checkpoint/job_checkpttest_0001/2/1";
    FSDataInputStream in = dfs.open(new Path(expectedPath));

    String className = in.readUTF();
    Text message = (Text) ReflectionUtils.newInstance(Class.forName(className),
        config);
    message.readFields(in);

    assertEquals("data", message.toString());
View Full Code Here

      // If not pb'd, make it so.
      if (!ProtobufUtil.isPBMagicPrefix(content)) {
        String cid = new String();
        in = fs.open(idPath);
        try {
          cid = in.readUTF();
          clusterId = new ClusterId(cid);
        } catch (EOFException eof) {
          LOG.warn("Cluster ID file " + idPath.toString() + " was empty");
        } finally {
          in.close();
View Full Code Here

          namenode+"/srcdat",
          namenode+"/destdat"});
       
        // File should not be overwritten
        FSDataInputStream in = hdfs.open(destPath);
        String s = in.readUTF();
        System.out.println("Dest had: " + s);
        assertTrue("Dest got over written even with skip crc",
            s.equalsIgnoreCase(destData));
        in.close();
       
View Full Code Here

          namenode+"/srcdat",
          namenode+"/destdat"});
       
        // File should be overwritten
        in = hdfs.open(destPath);
        s = in.readUTF();
        System.out.println("Dest had: " + s);

        assertTrue("Dest did not get overwritten without skip crc",
            s.equalsIgnoreCase(srcData));
        in.close();
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.