Search This Site
Sep 02 2010 23:10 UTC | ||||||||||
Tutorials
CSV ManagerRatingsQuality
Recommendations
Questions
Got a question for us? Bookmarks |
Streaming DataCSV Manager can load and save your data in a continuous stream. This allows you to handle very large CSV files. Code Example
File csvfile = new File( "mydata.csv" );
CsvManager csvman = new CsvManager();
CsvLoader loader = csvman.makeLoader( csvfile );
loader.begin();
while( loader.hasNext() ) {
String[] fields = loader.next();
for( int field = 0; field < fields.length; field++ ) {
System.out.print( fields[field]+", " );
}
System.out.println();
}
loader.end();
This code example can load data from a very large CSV file one line at a time.
This means that the whole file is not loaded in memory which conserves resources
and makes the loading process a lot faster. All you have to do is call the
Use this method when...
makeLoader method can take a String containing the file path, a File object.
What happens when some rows contain more fields than others?
Each data row is returned individually as a What happens when some rows are missing fields?
The OK, how do I get the column headers?
The column headers are simply the first row of data returned.
If the column names are not in the first line, then they are either in a predefined line (say line 3),
so start loading lines from there using
But my data isn't in a file!
You are not restricted to loading CSV data only from files. The
What about saving data to a CSV file?
You can also save data to a CSV file one line at a time by calling the
File csvfile = new File( "mydata.csv" );
CsvManager csvman = new CsvManager();
CsvSaver saver = csvman.makeSaver( csvfile );
ArrayList data = new ArrayList();
data.add( new String[] {"1","a","AA"} );
data.add( new String[] {"2","b","BB"} );
saver.begin();
for( Iterator lineI = data.iterator(); lineI.hasNext(); ) {
String[] fields = (String[]) lineI.next();
saver.next( fields );
}
saver.end();
What other data structures can you handle?We also support: I need to see something working.Sure, no problem. Head on over to our online demo and try out CSV Manager on your own data. I have another question...If you have a particular question you need answered, just ask! We're happy to explain exactly how CSV Manager works and show you how to use it. |
FREE Email SupportAll CSV Manager licenses include a FREE 6 month Email Support Package, worth $1500.00. FREE XML ManagerAll CSV Manager licenses include a FREE XML Manager single developer license, worth $170.00. Any CSV FormatThe CSV Manager component can handle any style of tabular text data, from Excel CSV files to the UNIX passwd file.
| ||||||||
|
comment on this page
Home |
Search |
About Us |
Contact Us |
Our Products |
Documentation |
Resources |
Login
Copyright © 2004-2010 Ricebridge. All Rights Reserved. | ||||||||||