org.apache.cassandra.db
Class Scanner

java.lang.Object
  extended by org.apache.cassandra.db.Scanner
All Implemented Interfaces:
java.io.Closeable, IScanner<IColumn>

public class Scanner
extends java.lang.Object
implements IScanner<IColumn>

This class is used to loop through a retrieved column family to get all columns in Iterator style. Usage is as follows: Scanner scanner = new Scanner("table"); scanner.fetchColumnfamily(key, "column-family"); while ( scanner.hasNext() ) { Column column = scanner.next(); // Do something with the column } Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )


Constructor Summary
Scanner(java.lang.String table)
           
 
Method Summary
 void close()
           
 void fetch(java.lang.String key, java.lang.String cf)
          Fetch the columns associated with this key for the specified column family.
 boolean hasNext()
           
 IColumn next()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner(java.lang.String table)
Method Detail

fetch

public void fetch(java.lang.String key,
                  java.lang.String cf)
           throws java.io.IOException
Fetch the columns associated with this key for the specified column family. This method basically sets up an iterator internally and then provides an iterator like interface to iterate over the columns.

Specified by:
fetch in interface IScanner<IColumn>
Parameters:
key - key we are interested in.
cf - column family we are interested in.
Throws:
java.io.IOException

hasNext

public boolean hasNext()
                throws java.io.IOException
Specified by:
hasNext in interface IScanner<IColumn>
Throws:
java.io.IOException

next

public IColumn next()
Specified by:
next in interface IScanner<IColumn>

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException


Copyright © 2009 The Apache Software Foundation