net.nutch.io
Class SequenceFile.Reader

java.lang.Object
  extended bynet.nutch.io.SequenceFile.Reader
Enclosing class:
SequenceFile

public static class SequenceFile.Reader
extends Object

Writes key/value pairs from a sequence-format file.


Constructor Summary
SequenceFile.Reader(String file)
          Open the named file.
 
Method Summary
 void close()
          Close the file.
 Class getKeyClass()
          Returns the class of keys in this file.
 long getPosition()
          Return the current byte position in the input file.
 Class getValueClass()
          Returns the class of values in this file.
 int next(DataOutputBuffer buffer)
          Read the next key/value pair in the file into buffer.
 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.
 void seek(long position)
          Set the current byte position in the input file.
 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

SequenceFile.Reader

public SequenceFile.Reader(String file)
                    throws IOException
Open the named file.

Method Detail

close

public void close()
           throws IOException
Close the file.

Throws:
IOException

getKeyClass

public Class getKeyClass()
Returns the class of keys in this file.


getValueClass

public Class getValueClass()
Returns the class of values in this file.


next

public boolean next(Writable key)
             throws IOException
Read the next key in the file into key, skipping its value. True if another entry exists, and false at end of file.

Throws:
IOException

next

public boolean next(Writable key,
                    Writable val)
             throws IOException
Read the next key/value pair in the file into key and val. Returns true if such a pair exists and false when at end of file

Throws:
IOException

next

public int next(DataOutputBuffer buffer)
         throws IOException
Read the next key/value pair in the file into buffer. Returns the length of the key read, or -1 if at end of file. The length of the value may be computed by calling buffer.getLength() before and after calls to this method.

Throws:
IOException

seek

public void seek(long position)
          throws IOException
Set the current byte position in the input file.

Throws:
IOException

getPosition

public long getPosition()
Return the current byte position in the input file.


toString

public String toString()
Returns the name of the file.



Copyright © 2004 The Nutch Organization.