Processing bank files

Hi everyone.

I have a text file, filled with information provided by the bank where my company has an account. The information contained in it has to be imported into the company's system.

The file contains a series of fields: numeric and alphanumeric. The length of a field is not static, I mean a numeric / alphanumeric field can be of 1 byte syze it can be bigger (2 bytes).

I was thinking of using Scanner to tokenize the file, the problem is: the file doesnt have a separator character to isolate fields. Then I tought of using Scanner Wrapper methods (getNextDouble()... getNextXXX()) but I fear I cant use it because the legth of fields is dynamic.

Anybody suggest sth...

I am in trouble..

Thanks in advance

[765 byte] By [charllescubaa] at [2007-11-27 8:51:58]
# 1
Ask the bank for the spec. of the file format. It won't have undelimited, variable-length fields in it, they'll either be of a fixed length, or have a delimiter. Quite often with banks, the delimiter isn't a printable character, so that might explain why it appears not to have
georgemca at 2007-7-12 21:06:30 > top of Java-index,Java Essentials,Java Programming...
# 2

Yeah

It might have non printable characters.

One thing I know, the field values come all togheter inside the file. So the following sequence can be the values of multiple fields (numeric and alphanumeric)

200012555C548JJT

Fields in the specification have a sequence number, so You know exactly what the next field value is. I dont know how to retrieve the values from inside the file yet. I cant use for example getNextDouble() from Scanner class? It might get lost when encountering a alphanumeric character? or will it distinguish the characters that compose a number?

charllescubaa at 2007-7-12 21:06:30 > top of Java-index,Java Essentials,Java Programming...
# 3

Your absolute best bet is to approach a technical contact at the bank and ask for the specification for the file format. They'll be more than happy to help you out, and a lot of banks will provide sample code in several popular languages for dealing with the file format. I'd be tempted not to use Scanner, either. Safest to treat the file as a byte array, in my experience of bank files

georgemca at 2007-7-12 21:06:30 > top of Java-index,Java Essentials,Java Programming...
# 4
Thank you georgemcWhat do you mean by byte array? Are you talkin about byte streams that read one byte at a time?Sorry English is not my official language...:)
charllescubaa at 2007-7-12 21:06:30 > top of Java-index,Java Essentials,Java Programming...
# 5
> Thank you georgemc> > What do you mean by byte array? Are you talkin about> byte streams that read one byte at a time?> Sorry English is not my official language...> > :)Yeh, basically
georgemca at 2007-7-12 21:06:30 > top of Java-index,Java Essentials,Java Programming...