Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

reading characters from a file?

807569May 15 2006
hi. i want to read characters from a file("sample.txt") that contains the following:
# LOCATIONS

# number of locations
15

# intersections
1st St & 101st Ave
1st St & 102nd Ave
1st St & 103rd Ave
2nd St & 101st Ave
2nd St & 102nd Ave
2nd St & 103rd Ave
3rd St & 101st Ave
3rd St & 102nd Ave
3rd St & 103rd Ave

# Freeway North locations
Freeway North @ 101st Ave
Freeway North @ 102nd Ave
Freeway North @ 103rd Ave

# Freeway South locations
Freeway South @ 101st Ave
Freeway South @ 102nd Ave
Freeway South @ 103rd Ave


# ROAD SEGMENTS

# number of road segments
40

# 1st St
0 1 1.5 30.0
1 0 1.5 27.5
1 2 2.0 30.5
2 1 2.0 27.5

# 2nd St
3 4 1.5 26.5
4 3 1.5 28.0
4 5 2.0 30.2
5 4 2.0 24.5

# 3rd St
6 7 1.5 29.0
7 6 1.5 28.5
7 8 2.0 35.2
8 7 2.0 32.5

# 101st Ave
0 3 2.3 37.5
3 0 2.3 37.4
3 6 2.5 39.2
6 3 2.5 38.5

# 102nd Ave
1 4 2.3 30.3
4 1 2.3 32.5
4 7 2.5 31.5
7 4 2.5 30.9

# 103rd Ave
2 5 2.3 42.6
5 2 2.3 40.5
5 8 2.5 42.8
8 5 2.5 43.2

# Freeway North
11 10 2.75 57.6
10 9 3.2 59.3

# Freeway North on and off ramps
0 9 0.05 40.1
9 0 0.05 39.5
4 10 0.1 37.1
10 4 0.1 39.0
8 11 0.07 35.4
11 8 0.07 37.6

# Freeway South
12 13 2.75 60.0
13 14 3.2 59.5

# Freeway South on and off ramps
0 12 0.06 40.0
12 0 0.06 40.5
4 13 0.09 38.5
13 4 0.09 39.0
8 14 0.08 41.5
14 8 0.08 37.5


# TRIPS

# number of trips to analyze
4

# the trips
0 8 D
1 8 T
2 7 T
12 14 D
what i want to do is read each line seperately except for the lines that start with a '#' sign and store the information. i tried the readLine() method but i cant seem to read off any characters from where i store each line. any help is appreciated. thanks

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 12 2006
Added on May 15 2006
0 comments
98 views