You can go for BufferedReader class. readLine() method will return you a line of text.
Create instances of transfer object corresponding to each and very part of your file and populate each transfer objects by 4 lines of each part. This will return you three different transfer objects corresponding to three different parts.
A Random Access File is really good when a file has fixed-length chunks. In this file it would be pretty hard to seek directly to the start of the second block without just reading the first block.
Years ago PJ Plauger suggested any file structure is a mini-language and any file reader is a mini-parser. For some reason I always got a lot of pleasure out of making little language files like this and parsers to read them.
See if you can make a method that looks like:
Use better names ... BlockOne is something about SMS header? Each readWhatever would read lines until it hits a blank one.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Sep 21, 2005
thanks your help first,I think I don't describe the problem clearly, the first bolock of content is fixed-length chunk, the others bolck is unfiexd-length block ,how to do ? thanks