org.vivoweb.harvester.util.repo
Class XMLRecordOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.vivoweb.harvester.util.repo.XMLRecordOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Cloneable

public class XMLRecordOutputStream
extends java.io.OutputStream
implements java.lang.Cloneable

An Output Stream that breaks XML blobs into individual Records and writes to a RecordHandler

Author:
Christopher Haines (hainesc@ctrip.ufl.edu)

Constructor Summary
XMLRecordOutputStream(java.lang.String[] tagsToSplitOn, java.lang.String headerInfo, java.lang.String footerInfo, java.lang.String idLocationRegex, RecordHandler recordHandler, java.lang.Class<?> operator)
          Constructor
 
Method Summary
 XMLRecordOutputStream clone()
           
 XMLRecordOutputStream setRecordHandler(RecordHandler rh)
          Set the record handler
 void write(int arg0)
           
 
Methods inherited from class java.io.OutputStream
close, flush, write, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLRecordOutputStream

public XMLRecordOutputStream(java.lang.String[] tagsToSplitOn,
                             java.lang.String headerInfo,
                             java.lang.String footerInfo,
                             java.lang.String idLocationRegex,
                             RecordHandler recordHandler,
                             java.lang.Class<?> operator)
Constructor

Parameters:
tagsToSplitOn - defines the record tag types
headerInfo - prepended to each record
footerInfo - appended to each record
idLocationRegex - regex to find the data to be used as ID
recordHandler - RecordHandler to write records to
operator - the class writing records
Method Detail

clone

public XMLRecordOutputStream clone()
Overrides:
clone in class java.lang.Object

write

public void write(int arg0)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

setRecordHandler

public XMLRecordOutputStream setRecordHandler(RecordHandler rh)
Set the record handler

Parameters:
rh - new record handler
Returns:
self reference