Re: [Servingxml-help] Writing to a buffer
Brought to you by:
danielaparker
From: Daniel P. <dan...@sy...> - 2007-03-29 01:01:18
|
You can override the endRecordStream method of RecordFilter to be = notified of when the last record is received. Just call = super.endRecordStream before returning from your method. Your other question is really a Java question, but you can use = java.io.ByteArrayOutputStream in much the same way as you were thinking = about using a StringWriter. Daniel ----- Original Message -----=20 From: Ravikumar Tadysetty=20 To: ser...@li...=20 Sent: Wednesday, March 28, 2007 8:49 PM Subject: [Servingxml-help] Writing to a buffer Hi I am converting a large flat file to xml using servingXml. I am trying = to write the xml to a buffer instead of a physical file. After certain = number of lines/records are transformed to xml, I am planning to invoke = a listener or trigger which would consume/process the xml generated so = far and return control so that the next set of records are converted. I = am considering the following approach:=20 Write a record filter and maintain a count of records. After the = desired number of records are written, I notify a listener which can = process the xml produced so far. I see an issue with this. The = writeRecord method doesnot tell me if I am at the end of the file. So I = wouldnot know when to fire the listener for the last set of records. = Please let me know if this approach can be followed.=20 Regarding writing to a buffer, I would like to use a = java.io.StringWriter so that I can read from it. But = OutputStreamSinkAdaptor doesnot take a java.io.Writer as a parameter to = the constructor. It would only take an OutputStream. Is there any other = way I can write to a buffer which can also be read and cleared while the = xml transformation is in progress.=20 Regards Ravi -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to = share your opinions on IT & business topics through brief surveys-and earn cash = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV -------------------------------------------------------------------------= ----- _______________________________________________ Servingxml-help mailing list Ser...@li... https://lists.sourceforge.net/lists/listinfo/servingxml-help |