Lines reading in file selectively

Is there a way that I can read the lines in a file selectively? Jumping to the line number directly and read from that line onwards without having to read each line one by one.

Example,

DBConfig.properites is the simple ASCII file with content like below.

#UNIT

dbname=DBUnit

uid=unit

pwd=xxx

#MODEL

dbname=DBModel

uid=model

pwd=xxx

#PROD

dbname=DBProd

uid=prod

pwd=xxx

Depending on the parameter that has been passed to me whether it is unit/model/prod I want to read only that block of lines from the file and then store them in a Hashtable as key-value pairs. I don't want to do a line by line reading and doing one by one comparison here. Is this possible?

Thanks,

Gopal

[786 byte] By [g0pal] at [2007-9-30 19:25:34]
# 1
If the line length is constant (all lines the same length) then use RandomAccessFile class.You can pad lines with trailing spaces to make them the same length.
ChuckBing at 2007-7-6 23:39:11 > top of Java-index,Administration Tools,Sun Connection...