## org.apache.hadoop.mapred.join
Class WrappedRecordReader<K extends WritableComparable,U extends Writable>

    java.lang.Object
      org.apache.hadoop.mapred.join.WrappedRecordReader<K,U>

All Implemented Interfaces:
  Comparable<ComposableRecordReader<K,?>>, ComposableRecordReader<K,U>, RecordReader<K,U>

    public class WrappedRecordReader<K extends WritableComparable,U extends Writable>

extends Object
implements ComposableRecordReader<K,U>

Proxy class for a RecordReader participating in the join framework. This class keeps track of the "head" key-value pair for the provided RecordReader and keeps a store of values matching a key when this source is participating in a join.

Method Summary
`void` `accept(org.apache.hadoop.mapred.join.CompositeRecordReader.JoinCollector i, K key)` Add an iterator to the collector at the position occupied by this RecordReader over the values in this stream paired with the key provided (ie register a stream of values from this source matching K with a collector).
`void` `close()` Forward close request to proxied RR.
`int` `compareTo(ComposableRecordReader<K,?> other)` Implement Comparable contract (compare key at head of proxied RR with that of another).
`K` `createKey()` Request new key from proxied RR.
`U` `createValue()` Request new value from proxied RR.
`boolean` `equals(Object other)` Return true iff compareTo(other) retn true.
`long` `getPos()` Request position from proxied RR.
`float` `getProgress()` Request progress from proxied RR.
`int` `hashCode()`
`boolean` `hasNext()` Return true if the RR- including the k,v pair stored in this object- is exhausted.
`int` `id()` Return the position in the collector this class occupies.
`K` `key()` Return the key at the head of this RR.
`void` `key(K qkey)` Clone the key at the head of this RR into the object supplied.
`protected boolean` `next()` Read the next k,v pair into the head of this object; return true iff the RR and this are exhausted.
`boolean` `next(K key, U value)` Write key-value pair at the head of this stream to the objects provided; get next key-value pair from proxied RR.
`void` `skip(K key)` Skip key-value pairs with keys less than or equal to the key provided.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### id

    public int id()

  Return the position in the collector this class occupies.

  Specified by:
    `id` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`

### key

    public K key()

  Return the key at the head of this RR.

  Specified by:
    `key` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`

### key

    public void key(K qkey)
             throws IOException

  Clone the key at the head of this RR into the object supplied.

  Specified by:
    `key` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`
  Throws:
    `IOException`

### hasNext

    public boolean hasNext()

  Return true if the RR- including the k,v pair stored in this object- is exhausted.

  Specified by:
    `hasNext` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`

### skip

    public void skip(K key)
              throws IOException

  Skip key-value pairs with keys less than or equal to the key provided.

  Specified by:
    `skip` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`
  Throws:
    `IOException`

### next

    protected boolean next()
                    throws IOException

  Read the next k,v pair into the head of this object; return true iff the RR and this are exhausted.

  Throws:
    `IOException`

### accept

    public void accept(org.apache.hadoop.mapred.join.CompositeRecordReader.JoinCollector i,
                       K key)
                throws IOException

  Add an iterator to the collector at the position occupied by this RecordReader over the values in this stream paired with the key provided (ie register a stream of values from this source matching K with a collector).

  Specified by:
    `accept` in interface `ComposableRecordReader<K extends WritableComparable,U extends Writable>`
  Throws:
    `IOException`

### next

    public boolean next(K key,
                        U value)
                 throws IOException

  Write key-value pair at the head of this stream to the objects provided; get next key-value pair from proxied RR.

  Specified by:
    `next` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Parameters:
    `key` - the key to read data into
    `value` - the value to read data into
  Returns:
    true iff a key/value was read, false if at EOF
  Throws:
    `IOException`

### createKey

    public K createKey()

  Request new key from proxied RR.

  Specified by:
    `createKey` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Returns:
    a new key object.

### createValue

    public U createValue()

  Request new value from proxied RR.

  Specified by:
    `createValue` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Returns:
    a new value object.

### getProgress

    public float getProgress()
                      throws IOException

  Request progress from proxied RR.

  Specified by:
    `getProgress` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Returns:
    progress from `0.0` to `1.0`.
  Throws:
    `IOException`

### getPos

    public long getPos()
                throws IOException

  Request position from proxied RR.

  Specified by:
    `getPos` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Returns:
    the current position in the input.
  Throws:
    `IOException`

### close

    public void close()
               throws IOException

  Forward close request to proxied RR.

  Specified by:
    `close` in interface `RecordReader<K extends WritableComparable,U extends Writable>`
  Throws:
    `IOException`

### compareTo

    public int compareTo(ComposableRecordReader<K,?> other)

  Implement Comparable contract (compare key at head of proxied RR with that of another).

  Specified by:
    `compareTo` in interface `Comparable<ComposableRecordReader<K extends WritableComparable,?>>`

### equals

    public boolean equals(Object other)

  Return true iff compareTo(other) retn true.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Copyright © 2009 The Apache Software Foundation