Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.IntWritable.readFields()


          TMP_FINAL_FILE))) {
        int numItems = in.readInt();
        assertEquals(290, numItems);
        IntWritable iw = new IntWritable();
        for (int i = 0; i < numItems; i++) {
          iw.readFields(in);
          assertEquals(i, iw.get());
        }
      }

    } finally {
View Full Code Here


          int items = open.readInt();
          int last = Integer.MIN_VALUE;
          // check the order if ascending
          for (int i = 0; i < items; i++) {
            assertEquals(4, WritableUtils.readVInt(open));
            iw.readFields(open);
            assertTrue(last < iw.get());
            result[iw.get()] = 0;
            last = iw.get();
            readItems++;
          }
View Full Code Here

      try (DataInputStream in = new DataInputStream(new FileInputStream(OUTPUT))) {
        int numItems = in.readInt();
        assertEquals(result.length, numItems);
        IntWritable iw = new IntWritable();
        for (int i = 0; i < numItems; i++) {
          iw.readFields(in);
          assertEquals(result[i], iw.get());
        }
      }

    } finally {
View Full Code Here

    }

    public void readAnnotationFields(Annotation annot, DataInput in,
            List<String> types) throws IOException {
        IntWritable posType = new IntWritable();
        posType.readFields(in);
        annot.setType(types.get(posType.get()));
        annot.setStart(WritableUtils.readVLong(in));
        annot.setEnd(WritableUtils.readVLong(in));
        HashMap<String, String> features = null;
        int numFeatures = in.readInt();
View Full Code Here

        HashMap<String, String> features = null;
        int numFeatures = in.readInt();
        if (numFeatures > 0)
            features = new HashMap<String, String>(numFeatures);
        for (int i = 0; i < numFeatures; i++) {
            posType.readFields(in);
            String fname = types.get(posType.get());
            String fvalue = WritableUtils.readString(in);
            features.put(fname, fvalue);
        }
        annot.setFeatures(features);
View Full Code Here

    CheckPointDataInput checkpointInput = new CheckPointDataInput(orbConf, superStep, partition);
   
    // Data is read on a FIFO basis
   
    IntWritable intInput = new IntWritable();
    intInput.readFields(checkpointInput);
   
    LongWritable longInput = new LongWritable();
    longInput.readFields(checkpointInput);
   
    Text textInput = new Text();
View Full Code Here

  }
 
  /** read the int value */
  static int readInt(DataInput in) throws IOException {
    IntWritable uInt = TL_DATA.get().U_INT;
    uInt.readFields(in);
    return uInt.get();
  }
 
  /** write the int value */
  static void writeInt(int value, DataOutputStream out) throws IOException {
View Full Code Here

    }

    public void readAnnotationFields(Annotation annot, DataInput in,
            List<String> types) throws IOException {
        IntWritable posType = new IntWritable();
        posType.readFields(in);
        annot.setType(types.get(posType.get()));
        annot.setStart(WritableUtils.readVLong(in));
        annot.setEnd(WritableUtils.readVLong(in));
        HashMap<String, String> features = null;
        int numFeatures = in.readInt();
View Full Code Here

        HashMap<String, String> features = null;
        int numFeatures = in.readInt();
        if (numFeatures > 0)
            features = new HashMap<String, String>(numFeatures);
        for (int i = 0; i < numFeatures; i++) {
            posType.readFields(in);
            String fname = types.get(posType.get());
            String fvalue = WritableUtils.readString(in);
            features.put(fname, fvalue);
        }
        annot.setFeatures(features);
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.