aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes About I/O streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "About I/O streams" Watch "About I/O streams" New topic
Author

About I/O streams

Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
JQ+Question Id :953742349090
Which of these can act as a source for an input stream as well as a destination for an output stream? Select 3 answers -
1. Network connection
2. File
3. Pipe
4. String
5. Array of characters
ANS : 1,2,3
About option 5 it says: you can create CharArrayReader or CharArrayWriter but there is nothing like CharArrayInputStream or ChararrayOutputStream.
I agree on the explaination.
But KM says , input stream is an object used to read the sequence of data and outputstream is an object used to write sequence of data. so array of bytes or characters can act as i/o stream.
So I am confused... whom to consider....KM or JQ+ as both are good.
Thanx in advance.
Rashmi
DC Dalton
Ranch Hand

Joined: May 28, 2001
Posts: 287
I think you are reading more into this question than needs to be, I did the same thing the first time I saw it but then realized my error (or should I say what they were really trying to ask). Granted the question could have been worded better but I really think what they are trying to ask is what external sources can be used for an Input/Output stream.....given that context I think the question (and answer) makes more sense.
[ January 13, 2002: Message edited by: DC Dalton ]
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi Rashmi,
i guess the confusion is because of word "stream" in the question. if it would have been only 'input' then v can b sure of the answer.
but if i'd 've been there i 'd think that in question its not given that it shd b "byte kind of stream" so..i'd choose char array as well.
regards
maulin.
Wagner Danda
Greenhorn

Joined: Jul 10, 2001
Posts: 26
Originally posted by Rashmi Gunjotikar:
But KM says , input stream is an object used to read the sequence of data and outputstream is an object used to write sequence of data. so array of bytes or characters can act as i/o stream.

Rashmi,
that classes (CharArray...) could act like an InputStream/OutputStream, but they are subclasses of Reader/Writer, so thay "aren't" InputStream/OutputStram classes.
PS: Sorry about my english.
[ January 14, 2002: Message edited by: Wagner Danda ]

Wagner Danda<br />Sun Certified Programmer for Java 2 Platform
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
i am quoting KM page 549 18.1. just in the beginning of this chapter 18
"the following entities can act as both input and output streams.
an array of bytes or characters
a file
a pipe
a network connection "
ok so now should option 5 be included in the answer ?
please reply asap.
Originally posted by Rashmi Gunjotikar:
JQ+Question Id :953742349090
Which of these can act as a source for an input stream as well as a destination for an output stream? Select 3 answers -
1. Network connection
2. File
3. Pipe
4. String
5. Array of characters
ANS : 1,2,3
About option 5 it says: you can create CharArrayReader or CharArrayWriter but there is nothing like CharArrayInputStream or ChararrayOutputStream.
I agree on the explaination.
But KM says , input stream is an object used to read the sequence of data and outputstream is an object used to write sequence of data. so array of bytes or characters can act as i/o stream.
So I am confused... whom to consider....KM or JQ+ as both are good.
Thanx in advance.
Rashmi
mark stone
Ranch Hand

Joined: Dec 18, 2001
Posts: 417
reposting. it is still unanswered....

Originally posted by mark stone:
i am quoting KM page 549 18.1. just in the beginning of this chapter 18
"the following entities can act as both input and output streams.
an array of bytes or characters
a file
a pipe
a network connection "
ok so now should option 5 be included in the answer ?
please reply asap.
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
input stream is an object used to read the sequence of data and outputstream is an object used to write sequence of data. so array of bytes or characters can act as i/o stream.
I think the term "i/o stream" is not meaning here just Input/OutputStreams but the whole byte/character i/o.
It was used in a general i/o sense.
[ January 15, 2002: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About I/O streams