SetFile.Reader (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.io, class: SetFile, class: Reader

Package org.apache.hadoop.io

# Class SetFile.Reader

java.lang.Object
org.apache.hadoop.io.MapFile.Reader
org.apache.hadoop.io.SetFile.Reader

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

Enclosing class:
  SetFile

public static class SetFile.Reader extends MapFile.Reader
Provide access to an existing set file.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.io.MapFile.Reader

  `MapFile.Reader.Option`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Reader(FileSystem fs, String dirName, Configuration conf)`
  Construct a set reader for the named set.
  `Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf)`
  Construct a set reader for the named set using the named comparator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WritableComparable`
  `get(WritableComparable key)`
  Read the matching key from a set into `key`.
  `boolean`
  `next(WritableComparable key)`
  Read the next key in a set into `key`.
  `boolean`
  `seek(WritableComparable key)`
  Positions the reader at the named key, or if none such exists, at the first entry after the named key.

  ### Methods inherited from class org.apache.hadoop.io.MapFile.Reader

  `close, comparator, createDataFileReader, finalKey, get, getClosest, getClosest, getKeyClass, getValueClass, midKey, next, open, reset`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Reader

    public Reader(FileSystem fs, String dirName, Configuration conf) throws IOException
    Construct a set reader for the named set.
    Parameters:
      `fs` - input FileSystem.
      `dirName` - input dirName.
      `conf` - input Configuration.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### Reader

    public Reader(FileSystem fs, String dirName, WritableComparator comparator, Configuration conf) throws IOException
    Construct a set reader for the named set using the named comparator.
    Parameters:
      `fs` - input FileSystem.
      `dirName` - input dirName.
      `comparator` - input comparator.
      `conf` - input Configuration.
    Throws:
      `IOException` - raised on errors performing I/O.

- ## Method Details

  - ### seek

    public boolean seek(WritableComparable key) throws IOException
    Description copied from class: `MapFile.Reader`
    Positions the reader at the named key, or if none such exists, at the first entry after the named key. Returns true iff the named key exists in this map.
    Overrides:
      `seek` in class `MapFile.Reader`
    Parameters:
      `key` - key.
    Returns:
      if the named key exists in this map true, not false.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### next

    public boolean next(WritableComparable key) throws IOException
    Read the next key in a set into `key`.
    Parameters:
      `key` - input key.
    Returns:
      Returns true if such a key exists and false when at the end of the set.
    Throws:
      `IOException` - raised on errors performing I/O.

  - ### get

    public WritableComparable get(WritableComparable key) throws IOException
    Read the matching key from a set into `key`.
    Parameters:
      `key` - input key.
    Returns:
      Returns `key`, or null if no match exists.
    Throws:
      `IOException` - raised on errors performing I/O.