Rossen Stoyanchev

Greenhorn
+ Follow
since Oct 16, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rossen Stoyanchev

I was studying the use of Decorator in the java.io package. According to the GoF book it's a good idea to have a "base" decorator which handles the job of delegating requests to the contained object for all methods.
I noticed that for InputStreams, the class FilterInputStream serves as a "base" decorator class, while in Readers there is no "base" decorator class. Actually FilterReader seems to be intended for that role, but then BufferedReader (which is a decorator) does not extend from it.
What is the reason for this incosistency? According to the book if there is only one decorator then there is no need for a "base" but that doesn't seem to fit the case here.
Thanks.

Hi thanks to all of you!
Hi Sonir, I think doing tests is very important. They test your knowledge and bring additional points to mind. However you must first have the basic knowledge!
The book is good starting point- read each chapter. To get further insight, search the JavaRanch Certification forum. I found many interesting discussion there with points beyond what any book can cover. Also, follow your curiousity and spend time building sample programs. There is no substitute for that especially when it comes to i/o, threads, and awt. Hope this helps- best of luck!
23 years ago

Just passed the test with 93%!! There were at least 3 or 4 questions from i/o and threads each, about the same or less in awt (1 gridbag but relatively easy), and from the rest I remember seeing lots of overriding/overloading questions.
I wanted to thank those who donate their time and share their knowledge on JavaRanch especially in the certification forum. I have not asked many questions there but that's because of the great amount of in-depth answers already available. Those were very invaluable and very motivating so thanks! Now that I've completed my goal I would like to do the same for others to the extent that I can!
thanks Ross
23 years ago

Hi-
This is from Kai's notes:
Connect to a socket s read one line of ASCII char. Please construct the right input method:
1) InputStream in = new InputStream(s.getInputStream());
2) DataInputStream in = new DataInputStream(s.getInputStream());
3) BufferedReader in = new BufferedReader(InputStreamReader(s.getInputStream());
4) BufferedReader in = new BufferedReader(InputStreamReader(s.getInputStream(), "8859_1");
I believe 2 & 3 are the correct choices. Both classes have readLine(). Answer 4 is incorrect because the "8859_1" should be "ISO-8859-1". Answer 1 is incorrect because an InputStream cannot read lines and it does not have such a constructor.
Is this correct? I'm confused about character encodings when it comes to reading ascii characters, does it matter whether the encoding is ISO-8859-1 or the platform default. And with this phrasing of the question is DataInputStream also a correct choice?