Package org.apache.hadoop.io

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


      for (int i = 0; i < 200; ++i) {
        intWritable.readFields(inStream);
        assertEquals(intWritable.get(), i);
      }

      intWritable.readFields(inStream);
      assertEquals(intWritable.get(), 199);

      try {
        intWritable.readFields(inStream);
        assertFalse(true);
View Full Code Here


      intWritable.readFields(inStream);
      assertEquals(intWritable.get(), 199);

      try {
        intWritable.readFields(inStream);
        assertFalse(true);
      } catch (Exception e) {
        assertTrue(true);
      }
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

   
    // Then read each value
   
    for (int i = 0; i < entries; i++) {
      IntWritable w = new IntWritable();
      w.readFields(in);
     
      instance.add(w);
    }
  }
}
View Full Code Here

                    throws IOException {
                    // LOG.info("Got Raw Record");
                    // initialize key / value readers .
                    keyReader.reset(keyData, keyOffset, keyLength);
                    valueReader.reset(valueData, valueOffset, valueLength);
                    keyObject.readFields(keyReader);
                    valueObject.readFields(valueReader);
                    this.spillRecord(keyObject, valueObject);
                }
            };
View Full Code Here

    ByteArrayInputStream bis = new ByteArrayInputStream(decompressed);
    DataInputStream dis = new DataInputStream(bis);

    IntWritable c = new IntWritable();
    c.readFields(dis);
    assertEquals(123, c.get());

    IntWritable d = new IntWritable();
    d.readFields(dis);
    assertEquals(321, d.get());
View Full Code Here

    IntWritable c = new IntWritable();
    c.readFields(dis);
    assertEquals(123, c.get());

    IntWritable d = new IntWritable();
    d.readFields(dis);
    assertEquals(321, d.get());
  }
}
View Full Code Here

  public void readFields(DataInput in) throws IOException {
    int len = in.readInt();
    tuple = new IntArrayList(len);
    IntWritable value = new IntWritable();
    for (int i = 0; i < len; i++) {
      value.readFields(in);
      tuple.add(value.get());
    }
  }
 
  @Override
View Full Code Here

  }
 
  private int readInt() throws IOException {
    dis.readInt(); // ignore (we know it's 4)
    IntWritable iw = new IntWritable();
    iw.readFields(dis);
    return iw.get();
  }
}
View Full Code Here

      byte[] bytes = filter.getConstant(options);

      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
      DataInputStream in = new DataInputStream(bais);
      writable.readFields(in);

      Assert.assertEquals(i, writable.get());

      baos.reset();
    }
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.