Regular expressions may be something you could look into.

If you can do it with perl for example I would probably go with Apache ORO
and probably:
              import org.apache.oro.text.perl.Perl5Util


My 2 cents.

Sib

On 12/21/06, Bryan Noll <[EMAIL PROTECTED]> wrote:

 These may be worth peaking at:

http://jakarta.apache.org/commons/vfs/
http://jakarta.apache.org/commons/transaction/ (transaction access to data
in files)

In particularly... this may pique your interest.  Problem is, it's still
in the sandbox, so they haven't had an official release or anything like
that.  That being said, it looks like it's not brand new code, but something
donated by some outfit called Netcetera, so it ought to be more mature than
its sandbox status would indicate.  That being said, that link lists three
other possibilities.  Maybe one of these can be of help to you.

http://jakarta.apache.org/commons/sandbox/csv/

Sanjiv Jivan wrote:

Seems fairly simple to read from this file format. Just open an
InputStream, read line by line looking for the header, trailer and other
details records. You could potentially also use regular expressions to read
entire records in one go but that would need you to read the stream contents
in memory and might not be efficient so the line by line approach seems
simple and efficient.

Basically just write a Java program to fit your needs. 30-40 lines of code
would probably get the job done in reading the sample format you provided.

Sanjiv

On 12/20/06, Josh <[EMAIL PROTECTED]> wrote:
>
>  The file itself consists of a header record, several different detail
> records and a trailer record.  The record type is driven by the first two
> characters on each line.  Each different record type has a fixed length
> format.
>
>
>
> Here is an very over simplified example:
>
>
>
> 810HDR    Invoice   1972-05-12John Doe
>
> 810DTL    01-2304040200       $2.34
>
> 810DTL    02-4030400400       $1.34
>
> 810TOT    600       $1004
>
> 810END    Steven
>
>
>
> In this example, you can see that characters 4-6 (HDR, DTL, TOT, END)
> drive the record type and each record type has a very specific record
> layout.
>
>
>
>
>
>
>  ------------------------------
>
> *From:* Sanjiv Jivan [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, December 20, 2006 6:02 PM
> *To:* [email protected]
> *Subject:* Re: [appfuse-user] OT: Suggestions for flat file library?
>
>
>
> What's the data format of the file? CSV or something custom?
>
> On 12/20/06, *Josh* <[EMAIL PROTECTED]> wrote:
>
> Sorry guys,
>
>
>
> I know this is old school, but I need to have the ability to parse flat
> files. Any suggestions?
>
> These flat files have a header, trailer and several types of detail
> records. I would appreciate any comments/advice.
>
> Best regards,
>
> Joshua
>
>
>
>
>


Reply via email to