org.egothor.repository
Class FastBlindAppender

java.lang.Object
  extended by org.egothor.repository.FastBlindAppender
All Implemented Interfaces:
URIRepositoryAppender

public class FastBlindAppender
extends java.lang.Object
implements URIRepositoryAppender

This class uses a simple way to recognize known URIs and their ids. It uses a bit array and URIs are hashed into it. Id of an URI is given as the bit offset in the array. Disk is not accessed during appending of URIs.

Author:
galambos

Constructor Summary
FastBlindAppender(java.lang.String filename, int capacity)
           
 
Method Summary
 long append(java.net.URI uri)
          Returns id or -id of the URI.
 void close()
           
 long size()
          Returns number of URIs in the base, or -1 iff the value is unknown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastBlindAppender

public FastBlindAppender(java.lang.String filename,
                         int capacity)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

append

public long append(java.net.URI uri)
            throws DatabaseStorageException
Returns id or -id of the URI. The value is never equal to 0.

Specified by:
append in interface URIRepositoryAppender
Throws:
DatabaseStorageException

close

public void close()
Specified by:
close in interface URIRepositoryAppender

size

public long size()
Description copied from interface: URIRepositoryAppender
Returns number of URIs in the base, or -1 iff the value is unknown.

Specified by:
size in interface URIRepositoryAppender