Member Avatar for shinny

Hi there,

I am trying to parse a .txt file and don't know where to start. I am trying to get the file information from within the text file and output it to a SWT table. The file I'm trying to parse looks like the following with useless information before and after the file information. All I really need to do is somehow get each line and take its individual pieces of data and store them in an array or something so I can put them into my table.

Any help would be much appreciated,

Kind Regards,

Shinny :)

--START OF TEXT FILE--
File: penDriveImage3.001
Start: Wed Aug 02 19:49:44 2006
Length: 992 MB (1040187392 bytes)

Num Name (bs=512) Size File Offset Comment

0: 8426.jpg 5 KB 4314525 (null)
1: 13578.jpg 42 KB 6952364 (null)
2: 13663.jpg 27 KB 6995952 (null)
3: 13791.jpg 26 KB 7061467 (null)
4: 14825.jpg 46 KB 7590486 (null)
5: 16830.jpg 83 KB 8617069 (null)
6: 16999.jpg 36 KB 8703995 (null)
...RANDOM DATA HERE...
--END OF TEXT FILE--

Member Avatar for iamthwee

Hi there,

I am trying to parse a .txt file and don't know where to start. I am trying to get the file information from within the text file and output it to a SWT table. The file I'm trying to parse looks like the following with useless information before and after the file information. All I really need to do is somehow get each line and take its individual pieces of data and store them in an array or something so I can put them into my table.

Any help would be much appreciated,

Kind Regards,

Shinny :)

--START OF TEXT FILE--
File: penDriveImage3.001
Start: Wed Aug 02 19:49:44 2006
Length: 992 MB (1040187392 bytes)

Num Name (bs=512) Size File Offset Comment

0: 8426.jpg 5 KB 4314525 (null)
1: 13578.jpg 42 KB 6952364 (null)
2: 13663.jpg 27 KB 6995952 (null)
3: 13791.jpg 26 KB 7061467 (null)
4: 14825.jpg 46 KB 7590486 (null)
5: 16830.jpg 83 KB 8617069 (null)
6: 16999.jpg 36 KB 8703995 (null)
...RANDOM DATA HERE...
--END OF TEXT FILE--

Looks fairly straight forward to me. Which part are you stuck on? Have you searched the web for tutorials regarding file handling in java and/or parsing lines into tokens?

Member Avatar for shinny

As I said above I don't know where to start, I've never done parsing before.

Shinny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.