This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How can i browse 3 files (same file format, exp: .txt) and process it ?  RSS feed

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i browse 3 files (same file format, exp: .txt) ,process and output it in one ?
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try something ? Can you read one file ?
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:Did you try something ? Can you read one file ?



ya, i can read and process one file but i don't know how to do multiple file .....
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can read one, you can read three, can't you ? A basic algorithm could be :

1. Open output file
2. For each input file
2.1 Open input file
2.2 Until input data left
2.2.1 Read input file
2.2.2 Output data
2.3 Close input file
3. Close output file
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:If you can read one, you can read three, can't you ? A basic algorithm could be :

1. Open output file
2. For each input file
2.1 Open input file
2.2 Until input data left
2.2.1 Read input file
2.2.2 Output data
2.3 Close input file
3. Close output file



Now i can ,
1.open file
2.read and process file
3.output data

but i wan,
1.open first file (.txt)
1.1open second file (.txt)
1.2open third file (.txt)
2.read all three file and process
3.output data in a textpad

Thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No matter how the algorithm looks like, if you can read one file, you can read three ! Show us the code you have so far.
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:No matter how the algorithm looks like, if you can read one file, you can read three ! Show us the code you have so far.



ok,
the fileread.txt is calculate the average , the filechoose.txt is UI to open file....



@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sample log file

#PlacelabStumbler Log Version 2
TYPE=TIMEOUT
TYPE=WIFI|TIME=1263867778390|ID=00:24:c3:31:2b:e0|NAME=csusm|RSSI=-93|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:12:17:7b:33:04|NAME=csusm|RSSI=-80|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-70|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1e:13:ee:3e:40|NAME=USMHotspot|RSSI=-85|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:24:c3:31:b8:80|NAME=csusm|RSSI=-91|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:90:4c:60:04:02|NAME=csusm|RSSI=-94|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1b:0d:d6:6d:50|NAME=USMHotspot|RSSI=-70|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1a:a2:dc:a0:60|NAME=USMHotspot|RSSI=-86|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867778390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-94|WEP=true|INFR=true
TYPE=TIMEOUT
TYPE=WIFI|TIME=1263867780390|ID=00:24:c3:31:b8:80|NAME=csusm|RSSI=-91|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-94|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:1a:a2:dc:a0:60|NAME=USMHotspot|RSSI=-91|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-82|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:12:17:7b:33:04|NAME=csusm|RSSI=-80|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:90:4c:60:04:02|NAME=csusm|RSSI=-89|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:1b:0d:d6:6d:50|NAME=USMHotspot|RSSI=-82|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867780390|ID=00:24:c3:31:2b:e0|NAME=csusm|RSSI=-93|WEP=true|INFR=true
TYPE=TIMEOUT
TYPE=WIFI|TIME=1263867782390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-94|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:24:c3:31:b8:80|NAME=csusm|RSSI=-91|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:1a:a2:dc:a0:60|NAME=USMHotspot|RSSI=-83|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:12:17:7b:33:04|NAME=csusm|RSSI=-80|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-80|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:1b:0d:d6:6d:50|NAME=USMHotspot|RSSI=-65|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:90:4c:60:04:02|NAME=csusm|RSSI=-77|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867782390|ID=00:24:c3:31:2b:e0|NAME=csusm|RSSI=-93|WEP=true|INFR=true
TYPE=TIMEOUT
TYPE=WIFI|TIME=1263867784390|ID=00:1e:c1:4c:c5:ce|NAME=3Com|RSSI=-90|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867784390|ID=00:1a:a2:dc:a0:60|NAME=USMHotspot|RSSI=-83|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867784390|ID=00:1f:27:55:f7:70|NAME=USMHotspot|RSSI=-62|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867784390|ID=00:24:c3:31:0f:e0|NAME=csusm|RSSI=-87|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867784390|ID=00:1b:0d:d6:6d:50|NAME=USMHotspot|RSSI=-86|WEP=true|INFR=true
TYPE=WIFI|TIME=1263867784390|ID=00:90:4c:60:04:02|NAME=csusm|RSSI=-79|WEP=true|INFR=true
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aaahh, you were talking about a JFileSelector... In your FileChooserDemo#actionPerformed, you could show the file selector three times, and retrieve the selected file each time, then process each file.

if (e.getSource() == openButton) {
1. Loop until three file selected
1.1 Show file selector
1.2 Store selected file (e.g. in an array)
2. Loop each file and process
 
motress zlting
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:aaahh, you were talking about a JFileSelector... In your FileChooserDemo#actionPerformed, you could show the file selector three times, and retrieve the selected file each time, then process each file.

if (e.getSource() == openButton) {
1. Loop until three file selected
1.1 Show file selector
1.2 Store selected file (e.g. in an array)
2. Loop each file and process




If say that i want to combine the data in those three selected file first then only process it ,can it works ? Any method to do that ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can read each file and store each line (fileScanner.nextLine()) in an array or a list.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!