Forum posts for reader

Casting to a reader or creating a new reader

I am a little bit confused by the following thing:

public randomConstructor(Reader r) {
this.bufferedreader = new BufferedReader(r);
}


It seem to be logical that if you want to use a BufferedReader you should create one and use the reader as a parameter. However, I saw something like that:

public randomConstructor(Reader r) {
this.bufferedreader = (BufferedReader) r;
}


Obivously it doesn't work if r isn't a BufferedReader itself.

Sorry if I can't give you any better example, but I can remember that there was an example where it actually made sense to cast it to a reader. Is there any exception where it does make sense?

EDIT: bufferedreader is obviously a private variable of the type 'BufferedReader' :)

View complete forum thread with replies

Other posts related to reader

See Related Forum Messages: Follow the Links Below to View Complete Thread

fingerprint reader or thumb reader
adobe reader and acrobat reader [closed]
reader vs buffered reader
CSV parser/reader for C#? [closed]
The “reader” monad
Fingerprint Reader
Blackberry smartcard reader example
Casting to a reader or creating a new reader
Fingerprint Reader
PDF Reader
fingerprint reader [closed]
InputStream reader
Buffered Reader
geotools reader
File reader encapsulation in a table reader

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.