iitb.con.query
Class ItemReader<T>

java.lang.Object
  extended by iitb.con.query.ItemReader<T>

public class ItemReader<T>
extends java.lang.Object

InstanceReader reads an instance item from the concept-net.


Constructor Summary
ItemReader(java.lang.String fileName, ItemSerializer<T> itemSerializer)
          Constructs the InstanceReader with respective file and item serializer
 
Method Summary
 void close()
          Closes the item file
 T getItem(long location, int length)
          Retrieves and deserialize the item from the file
 java.lang.Object getItemAttributeValue(long location, int length, java.lang.String name)
          Retrieves and deserialize the item from the file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemReader

public ItemReader(java.lang.String fileName,
                  ItemSerializer<T> itemSerializer)
           throws java.io.FileNotFoundException,
                  java.io.IOException
Constructs the InstanceReader with respective file and item serializer

Parameters:
fileName - file name of the where the item exists
itemSerializer - item serializer to decode the item
Throws:
java.io.FileNotFoundException - if file does not found
java.io.IOException - if file operation fails
Method Detail

close

public void close()
           throws java.io.IOException
Closes the item file

Throws:
java.io.IOException - if file operation fails

getItem

public T getItem(long location,
                 int length)
          throws java.io.IOException
Retrieves and deserialize the item from the file

Parameters:
location - item location
length - item length
Returns:
item (the type of item depends the Item Serializer)
Throws:
java.io.IOException

getItemAttributeValue

public java.lang.Object getItemAttributeValue(long location,
                                              int length,
                                              java.lang.String name)
                                       throws java.io.IOException
Retrieves and deserialize the item from the file

Parameters:
location - item location
length - item length
name - attribute name
Returns:
attribute's value as Object
Throws:
java.io.IOException