Package 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
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
ConstructorsConstructorDescriptionSegmentDescriptor(long segmentOffset, long segmentLength, Path segmentPathName) Constructs a segment -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()The default cleanup.intvoiddoSync()Do the sync checks.booleangetKey()inthashCode()booleanFills up the rawKey object with the key returned by the Reader.intnextRawValue(SequenceFile.ValueBytes rawValue) Fills up the passed rawValue with the value corresponding to the key read earlier.voidpreserveInput(boolean preserve) Whether to delete the files when no longer needed.boolean
-
Constructor Details
-
SegmentDescriptor
Constructs a segment- Parameters:
segmentOffset- the offset of the segment in the filesegmentLength- the length of the segmentsegmentPathName- 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
- Specified by:
compareToin interfaceComparable
-
equals
-
hashCode
public int hashCode() -
nextRawKey
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
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
- Returns:
- Returns the stored rawKey
-
cleanup
The default cleanup. Subclasses can override this with a custom cleanup.- Throws:
IOException- raised on errors performing I/O.
-