File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Reading large text files with multiple data types and items. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Reading large text files with multiple data types and items." Watch "Reading large text files with multiple data types and items." New topic

Reading large text files with multiple data types and items.

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
I am working on a project that reads data from text files. Every line in a the file corresponds to different data items. Data is pipe delimited.
I need to read each line and find out which table it maps to and then insert records into that table. I need to automatically pick the files from a particular directory(whenever the file is placed there).
Do you have any ideas how to get started, any sample code from any other project or links.
My data sample is like this.
01|05298258|TERMS: The past due amount is due immediately.|||
03|05298258| service.|||
10|05298258|| FULTONCOUNTY |ATTN: JO AVELLE|141 SW POR ST #9039||ATLANTA|GA|303033455|111210080|I|R|1||128||||||||||||
20|05298258|4045160216|FUlton OFFICE|141 POR ST|9039|ATLANTA|GA|303033444|111210080|I|FEDSSGOSGISG|99999999|2|||||||||||
30|05298258|4045160216|2|5|/HOME 700|49.99|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|3|5|/text BASIC VOICE MAIL NC|0.00|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|3|5|text BASICS|2.99|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|28|6|/HOME 700|16.66|1|20020819|20020828|0|||||||||||
30|05298258|4045160216|45|6|CONNECTION CHARGE|1.24|0|20020829|20020928|0|||||||||||
30|05298258|4045160216|43|10|UNIVERSAL SVC CHARGE|0.55|0|20020829|20020928|0|||||||||||
50|05298258|4045160216|20020828|092024|0000000099||VOICE MAIL|CL||P|180|0.00|0|0|0|0000000000|43||||||||||
50|05298258|4045160216|20020828|092724|0000000099||VOICE MAIL|CL||P|420|0.00|0|0|0|0000000000|44||||||||||
50|05298258|4045160216|20020828|180714|6784858361||ATLANTA NE|GA||P|60|0.00|0|0|0|0000000000|45||||||||||
the first record in every line maps to a particular table in our database.
Any ideas will be appreciated.
It is sorta covered in the JavaRanch Style Guide.
subject: Reading large text files with multiple data types and items.
Similar Threads
Help with ArrayList
complicated code, 900 labels.
Can get the Form Feed "\f" to work!
SCJD after the acquisition of Sun (by Oracle)
XSL-FO Multiple Page Sequences