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 Details

    • SegmentDescriptor

      public 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 Details

    • doSync

      public void doSync()
      Do the sync checks.
    • preserveInput

      public void preserveInput(boolean preserve)
      Whether to delete the files when no longer needed.
      Parameters:
      preserve - input boolean preserve.
    • 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 - raised on errors performing I/O.
    • 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 - input ValueBytes rawValue.
      Returns:
      the length of the value
      Throws:
      IOException - raised on errors performing I/O.
    • getKey

      public DataOutputBuffer getKey()
      Returns:
      Returns the stored rawKey
    • cleanup

      public void cleanup() throws IOException
      The default cleanup. Subclasses can override this with a custom cleanup.
      Throws:
      IOException - raised on errors performing I/O.