This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filteroutputstream

 
Anju Rao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL,
Following is the question from Barry boones:
You can attach a FilterOutputStream object to:
a) An underlying file
b) Another FilterOutputStream object,
c) A filterInputStream object
d) all of these.
I thought the answer was only b). But the answer is a,b. Only the FileInputstream can attach to an underlying file,so is this answer wrong?
Also, I want to understand the InputStream Reader, OutputStreamWriter classes - i am not finding them in the certification books. It just says "They convert between streams of Bytes and sequences of unicode characters". I didn't check the Marcus Site, but can anybody suggest me some reading material for this?
Thanks,
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the answer is either b or d, depending on interpretation. Of the choices listed, you can only directly attach a FilterInputStream to another FilterInputStream. But indirectly, you can attach any of them, through other types of streams. For C, you'd need a PipedInputStream connected to a PipedOutputStream - which is more obscure than you need to worry about for certification I think, but it's possible. Since it's a poorly-worded question, I wouldn't worry about it. (But feel free to write Barry to let him know about the problem.)
 
Anju Rao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jim! I agree with u that it is badly worded. I also see now why they could have possible picked "a" as the answer.
 
nkpriya
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
How we can know that what are the objects that can be attached to other object like eg:FilterOutputStream.
I think For FilterOutputStream there is only one constructor which takes the outputstream object.Is this related to above stmt.Can anyone explain this.
Thanks and Regards
Priya
 
P SOLAIAPPAN
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
The question given in the Barrey bone book is confusing.
The main confusion is:
a) An underlying file
FilterOutputStream takes only one constructor ie. OutputStream or its sub clsses. Filters can be combined, with one filter using the output of another as its input.
The question (a) should have been "FileOutputStream"
Then (a) is also correct. I thing, the book means that.
Since FileOutputStream is a subclass of OutPutStream it is ok.
(e.g)
BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("test.txt"));
Two good certification books on I/O is
1. A PROGRAMMER'S GUIDE TO JAVA CERTIFICATION - K A Mughal& R W Ramussen
2. JAVA2 CERTIFICATION BY Jamie Jaworski
solaiappan


[This message has been edited by P SOLAIAPPAN (edited October 24, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic