dragon.onlinedb
Class BasicCollectionWriter

java.lang.Object
  |
  +--dragon.onlinedb.BasicCollectionWriter
All Implemented Interfaces:
CollectionWriter

public class BasicCollectionWriter
extends java.lang.Object
implements CollectionWriter

Writing collection to disk

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Field Summary
protected  BasicArticleIndex articleIndex
           
protected  java.lang.String charSet
           
protected  ArticleParser parser
           
protected  java.io.RandomAccessFile rafCollection
           
 
Constructor Summary
BasicCollectionWriter(java.lang.String collectionFile, java.lang.String indexFile, boolean append)
           
 
Method Summary
 boolean add(Article article)
          Adds an article to the collection
 void close()
          Closes the collection writer and releases all resources.
 ArticleParser getArticleParser()
          Gets the article parser of the collection writer
 void setArticleParser(ArticleParser parser)
          Sets the article parser for the collection writer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rafCollection

protected java.io.RandomAccessFile rafCollection

articleIndex

protected BasicArticleIndex articleIndex

parser

protected ArticleParser parser

charSet

protected java.lang.String charSet
Constructor Detail

BasicCollectionWriter

public BasicCollectionWriter(java.lang.String collectionFile,
                             java.lang.String indexFile,
                             boolean append)
Method Detail

getArticleParser

public ArticleParser getArticleParser()
Description copied from interface: CollectionWriter
Gets the article parser of the collection writer

Specified by:
getArticleParser in interface CollectionWriter
Returns:
the article parser used for this collection writer

setArticleParser

public void setArticleParser(ArticleParser parser)
Description copied from interface: CollectionWriter
Sets the article parser for the collection writer

Specified by:
setArticleParser in interface CollectionWriter
Parameters:
parser - the article parser

add

public boolean add(Article article)
Description copied from interface: CollectionWriter
Adds an article to the collection

Specified by:
add in interface CollectionWriter
Parameters:
article - an article
Returns:
true if the article was added to the collection successfully.

close

public void close()
Description copied from interface: CollectionWriter
Closes the collection writer and releases all resources.

Specified by:
close in interface CollectionWriter