## org.apache.hadoop.io
Class SequenceFile.Sorter.SegmentDescriptor

    java.lang.Object
      org.apache.hadoop.io.SequenceFile.Sorter.SegmentDescriptor

All Implemented Interfaces:
  Comparable

Enclosing class:
  SequenceFile.Sorter

    public class SequenceFile.Sorter.SegmentDescriptor

extends Object
implements Comparable

This class defines a merge segment. This class can be subclassed to provide a customized cleanup method implementation. In this implementation, cleanup closes the file handle and deletes the file

Constructor Summary
`SequenceFile.Sorter.SegmentDescriptor(long segmentOffset, long segmentLength, Path segmentPathName)` Constructs a segment

Method Summary
`void` `cleanup()` The default cleanup.
`int` `compareTo(Object o)`
`void` `doSync()` Do the sync checks
`boolean` `equals(Object o)`
`DataOutputBuffer` `getKey()` Returns the stored rawKey
`int` `hashCode()`
`boolean` `nextRawKey()` Fills up the rawKey object with the key returned by the Reader
`int` `nextRawValue(SequenceFile.ValueBytes rawValue)` Fills up the passed rawValue with the value corresponding to the key read earlier
`void` `preserveInput(boolean preserve)` Whether to delete the files when no longer needed
`boolean` `shouldPreserveInput()`

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

Constructor Detail

### SequenceFile.Sorter.SegmentDescriptor

    public SequenceFile.Sorter.SegmentDescriptor(long segmentOffset,
                                                 long segmentLength,
                                                 Path segmentPathName)

  Constructs a segment

  Parameters:
    `segmentOffset` - the offset of the segment in the file
    `segmentLength` - the length of the segment
    `segmentPathName` - the path name of the file containing the segment

Method Detail

### doSync

    public void doSync()

  Do the sync checks

### preserveInput

    public void preserveInput(boolean preserve)

  Whether to delete the files when no longer needed

### shouldPreserveInput

    public boolean shouldPreserveInput()

### compareTo

    public int compareTo(Object o)

  Specified by:
    `compareTo` in interface `Comparable`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### nextRawKey

    public boolean nextRawKey()
                       throws IOException

  Fills up the rawKey object with the key returned by the Reader

  Returns:
    true if there is a key returned; false, otherwise
  Throws:
    `IOException`

### nextRawValue

    public int nextRawValue(SequenceFile.ValueBytes rawValue)
                     throws IOException

  Fills up the passed rawValue with the value corresponding to the key read earlier

  Parameters:
    `rawValue` -
  Returns:
    the length of the value
  Throws:
    `IOException`

### getKey

    public DataOutputBuffer getKey()

  Returns the stored rawKey

### cleanup

    public void cleanup()
                 throws IOException

  The default cleanup. Subclasses can override this with a custom cleanup

  Throws:
    `IOException`

Copyright © 2009 The Apache Software Foundation