Package org.apache.hadoop.fs

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


    // The docnos start at one, so we need an array that's one larger than number of docs.
    int sz = in.readInt() + 1;
    String[] arr = new String[sz];

    for (int i = 1; i < sz; i++) {
      arr[i] = in.readUTF();
    }
    in.close();

    // We can't leave the zero'th entry null, or else we might get a null pointer exception during a
    // binary search on the array.
View Full Code Here


      // If not pb'd, make it so.
      if (!ProtobufUtil.isPBMagicPrefix(content)) {
        String cid = null;
        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

      // If not pb'd, make it so.
      if (!ProtobufUtil.isPBMagicPrefix(content)) {
        String cid = null;
        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

      // If not pb'd, make it so.
      if (!ProtobufUtil.isPBMagicPrefix(content)) {
        String cid = null;
        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

    // 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 = null;
        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

      // If not pb'd, make it so.
      if (!ProtobufUtil.isPBMagicPrefix(content)) {
        String cid = null;
        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

    // 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

          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

          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

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.