posted 18 years ago
I have to read a .txt file from classpath containing values like this,
key = value
spaced key = spaced value
I have to capture the key and value.
I was intending to capture each line and use split or StringTokenizer to look for '=' to determine the key and value.
But on reading the file from classpath I get an InputStream. Is there any way to read each line in a file using InputStream?
Could someone provide a code snippet to the problem?
I could have used BufferedReader.readLine() if the file was in the working directory but the file is in the classpath and I have not found a way yet to read the file from the classpath and not obtain InputStream.
Can any one suggest how to obtain a Reader while reading a file from classpath?
Thanks in advance.