| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.io.SequenceFile.Reader
public static class SequenceFile.Reader
Reads key/value pairs from a sequence-format file.
| Constructor Summary | |
|---|---|
SequenceFile.Reader(FileSystem fs,
                    Path file,
                    Configuration conf)
Open the named file.  | 
|
| Method Summary | |
|---|---|
 void | 
close()
Close the file.  | 
 SequenceFile.ValueBytes | 
createValueBytes()
 | 
 CompressionCodec | 
getCompressionCodec()
Returns the compression codec of data in this file.  | 
 Object | 
getCurrentValue(Object val)
Get the 'value' corresponding to the last read 'key'.  | 
 void | 
getCurrentValue(Writable val)
Get the 'value' corresponding to the last read 'key'.  | 
 Class<?> | 
getKeyClass()
Returns the class of keys in this file.  | 
 String | 
getKeyClassName()
Returns the name of the key class.  | 
 SequenceFile.Metadata | 
getMetadata()
Returns the metadata object of the file  | 
 long | 
getPosition()
Return the current byte position in the input file.  | 
 Class<?> | 
getValueClass()
Returns the class of values in this file.  | 
 String | 
getValueClassName()
Returns the name of the value class.  | 
 boolean | 
isBlockCompressed()
Returns true if records are block-compressed.  | 
 boolean | 
isCompressed()
Returns true if values are compressed.  | 
 int | 
next(DataOutputBuffer buffer)
Deprecated. Call nextRaw(DataOutputBuffer,SequenceFile.ValueBytes). | 
 Object | 
next(Object key)
Read the next key in the file, skipping its value.  | 
 boolean | 
next(Writable key)
Read the next key in the file into key, skipping its
 value. | 
 boolean | 
next(Writable key,
     Writable val)
Read the next key/value pair in the file into key and
 val. | 
 int | 
nextRaw(DataOutputBuffer key,
        SequenceFile.ValueBytes val)
Read 'raw' records.  | 
 int | 
nextRawKey(DataOutputBuffer key)
Read 'raw' keys.  | 
 int | 
nextRawValue(SequenceFile.ValueBytes val)
Read 'raw' values.  | 
protected  FSDataInputStream | 
openFile(FileSystem fs,
         Path file,
         int bufferSize,
         long length)
Override this method to specialize the type of FSDataInputStream returned. | 
 void | 
seek(long position)
Set the current byte position in the input file.  | 
 void | 
sync(long position)
Seek to the next sync mark past a given position.  | 
 boolean | 
syncSeen()
Returns true iff the previous call to next passed a sync mark.  | 
 String | 
toString()
Returns the name of the file.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public SequenceFile.Reader(FileSystem fs,
                           Path file,
                           Configuration conf)
                    throws IOException
IOException| Method Detail | 
|---|
protected FSDataInputStream openFile(FileSystem fs,
                                     Path file,
                                     int bufferSize,
                                     long length)
                              throws IOException
FSDataInputStream returned.
IOExceptionpublic void close()
           throws IOException
close in interface CloseableIOExceptionpublic String getKeyClassName()
public Class<?> getKeyClass()
public String getValueClassName()
public Class<?> getValueClass()
public boolean isCompressed()
public boolean isBlockCompressed()
public CompressionCodec getCompressionCodec()
public SequenceFile.Metadata getMetadata()
public void getCurrentValue(Writable val)
                     throws IOException
val - : The 'value' to be read.
IOExceptionpublic Object getCurrentValue(Object val)
                       throws IOException
val - : The 'value' to be read.
IOExceptionpublic boolean next(Writable key)
             throws IOException
key, skipping its
 value.  True if another entry exists, and false at end of file.
IOExceptionpublic boolean next(Writable key,
                    Writable val)
             throws IOException
key and
 val.  Returns true if such a pair exists and false when at
 end of file
IOExceptionpublic int next(DataOutputBuffer buffer)
         throws IOException
nextRaw(DataOutputBuffer,SequenceFile.ValueBytes).
IOExceptionpublic SequenceFile.ValueBytes createValueBytes()
public int nextRaw(DataOutputBuffer key,
                   SequenceFile.ValueBytes val)
            throws IOException
key - - The buffer into which the key is readval - - The 'raw' value
IOExceptionpublic int nextRawKey(DataOutputBuffer key)
               throws IOException
key - - The buffer into which the key is read
IOExceptionpublic Object next(Object key)
            throws IOException
IOExceptionpublic int nextRawValue(SequenceFile.ValueBytes val)
                 throws IOException
val - - The 'raw' value
IOExceptionpublic void seek(long position)
          throws IOException
The position passed must be a position returned by SequenceFile.Writer.getLength() when writing this file.  To seek to an arbitrary
 position, use sync(long).
IOExceptionpublic void sync(long position)
          throws IOException
IOExceptionpublic boolean syncSeen()
public long getPosition()
                 throws IOException
IOExceptionpublic String toString()
toString in class Object
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||