org.apache.cassandra.io
Interface IFileReader

All Known Implementing Classes:
SequenceFile.AbstractReader, SequenceFile.BufferReader, SequenceFile.ChecksumReader, SequenceFile.Reader

public interface IFileReader

Interface to read from the SequenceFile abstraction. Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )


Method Summary
 void close()
          Close the file after reading.
 long getCurrentPosition()
           
 long getEOF()
           
 java.lang.String getFileName()
           
 long getPositionFromBlockIndex(java.lang.String key)
          This method helps is retrieving the offset of the specified key in the file using the block index.
 boolean isEOF()
           
 boolean isHealthyFileDescriptor()
           
 long next(DataOutputBuffer bufOut)
          This method dumps the next key/value into the DataOuputStream passed in.
 long next(java.lang.String key, DataOutputBuffer bufOut, Coordinate section)
          This method dumps the next key/value into the DataOuputStream passed in.
 long next(java.lang.String key, DataOutputBuffer bufOut, java.lang.String columnFamilyName, java.util.List<java.lang.String> columnNames, IndexHelper.TimeRange timeRange, Coordinate section)
          This method dumps the next key/value into the DataOuputStream passed in.
 void readDirect(byte[] bytes)
          Be extremely careful while using this API.
 long readLong()
          Read a long value from the underlying sub system.
 void seek(long position)
           
 

Method Detail

getFileName

java.lang.String getFileName()

getEOF

long getEOF()
            throws java.io.IOException
Throws:
java.io.IOException

getCurrentPosition

long getCurrentPosition()
                        throws java.io.IOException
Throws:
java.io.IOException

isHealthyFileDescriptor

boolean isHealthyFileDescriptor()
                                throws java.io.IOException
Throws:
java.io.IOException

seek

void seek(long position)
          throws java.io.IOException
Throws:
java.io.IOException

isEOF

boolean isEOF()
              throws java.io.IOException
Throws:
java.io.IOException

readDirect

void readDirect(byte[] bytes)
                throws java.io.IOException
Be extremely careful while using this API. This currently used to read the commit log header from the commit logs. Treat this as an internal API.

Parameters:
bytes - read into this byte array.
Throws:
java.io.IOException

readLong

long readLong()
              throws java.io.IOException
Read a long value from the underlying sub system.

Returns:
value read
Throws:
java.io.IOException

getPositionFromBlockIndex

long getPositionFromBlockIndex(java.lang.String key)
                               throws java.io.IOException
This method helps is retrieving the offset of the specified key in the file using the block index.

Parameters:
key - key whose position we need in the block index.
Throws:
java.io.IOException

next

long next(DataOutputBuffer bufOut)
          throws java.io.IOException
This method dumps the next key/value into the DataOuputStream passed in.

Parameters:
bufOut - DataOutputStream that needs to be filled.
Returns:
number of bytes read.
Throws:
java.io.IOException

next

long next(java.lang.String key,
          DataOutputBuffer bufOut,
          Coordinate section)
          throws java.io.IOException
This method dumps the next key/value into the DataOuputStream passed in.

Parameters:
key - key we are interested in.
bufOut - DataOutputStream that needs to be filled.
section - region of the file that needs to be read
Returns:
the number of bytes read.
Throws:
java.io.IOException

next

long next(java.lang.String key,
          DataOutputBuffer bufOut,
          java.lang.String columnFamilyName,
          java.util.List<java.lang.String> columnNames,
          IndexHelper.TimeRange timeRange,
          Coordinate section)
          throws java.io.IOException
This method dumps the next key/value into the DataOuputStream passed in. Always use this method to query for application specific data as it will have indexes.

Parameters:
key - - key we are interested in.
bufOut - - DataOutputStream that needs to be filled.
columnFamilyName - The name of the column family only without the ":"
columnNames - - The list of columns in the cfName column family that we want to return OR
timeRange - - time range we are interested in
section - region of the file that needs to be read
Returns:
number of bytes read.
Throws:
java.io.IOException

close

void close()
           throws java.io.IOException
Close the file after reading.

Throws:
java.io.IOException


Copyright © 2009 The Apache Software Foundation