|
From: <zep...@us...> - 2007-09-10 13:30:56
|
Revision: 351
http://flatpack.svn.sourceforge.net/flatpack/?rev=351&view=rev
Author: zepernick
Date: 2007-09-10 06:30:58 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
- added quick example for fixed width message.
- Corrected missed reference to File instead of FileReader
Modified Paths:
--------------
trunk/src/site/index.xml
Modified: trunk/src/site/index.xml
===================================================================
--- trunk/src/site/index.xml 2007-09-10 01:43:00 UTC (rev 350)
+++ trunk/src/site/index.xml 2007-09-10 13:30:58 UTC (rev 351)
@@ -135,8 +135,8 @@
<div class="source"><pre>
//Obtain the proper parser for your needs
Parser parser = DefaultParserFactory.getInstance().newDelimitedParser(
- new File("map.pzmap.xml"), //fixed with column map
- new File("DataFile.txt")); //txt file to parse
+ new FileReader("map.pzmap.xml"), //fixed with column map
+ new FileReader("DataFile.txt")); //txt file to parse
//obtain DataSet
DataSet ds = parser.parse();
@@ -151,9 +151,18 @@
<subsection name="Reading a Message of Fixed Width">
<div class="source"><pre>
+ final String msg = "data data2 data3 data4"
+ //Obtain the proper parser for your needs
+ Parser parser = DefaultParserFactory.getInstance().newDelimitedParser(
+ new FileReader("map.pzmap.xml"), //fixed with column map to bind col names
+ new StringReader(mag)); //data to parse
-... coming soon
+ //obtain DataSet
+ DataSet ds = parser.parse();
+ while (ds.next()){ //loop through file
+ ds.getString("mycolumnName");
+ }
</pre></div>
</subsection>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|