Re: Some java help needed!

"Diez B. Roggisch" <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Damar,

>Thanks, Diez.
>
>After looking at the javadocs, I did the following:
>
>Object obj = new Object();
>try{
>BufferedReader in =
>new BufferedReader(new
>FileReader
>(obj.getClass().getClassLoader().getResourceAsStream("countries.txt")));
>.....
>....
>}
>What is wrong here? I get the following error message: 
>
>cannot resolve symbol
>    [javac] symbol  : constructor FileReader (java.io.InputStream)
>    [javac] location: class java.io.FileReader
>    [javac] new BufferedReader(new
>    [javac]                    ^
>    [javac] 1 error
>
>I have imported java.io.*.
>
>  
>
I'm always glad if I can give you some advice how to achieve the goal 
you're after - but I can't and won't do the compilation-error 
interpreting for you. Besides that this will be way to slow over email 
and a time-zone difference of  probably several hours....

The error clearly states whats wrong - FileReader doesn't have a 
constructor of type InputStream. Most probably you won't a FileReader 
here, as you don't have a File - you have an InputStream. Maybe things 
work if you simply remove the FileReader at all.

I admit that ist sometimes tedious to work through the hierarchy of 
java.io classes - but a close look to the javadocs usually does the trick.

Regards,

Diez
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.