Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 5 - Parts 1 and 2
Date: Mon Nov 5 2001 6:43 pm
Author: Chen, Richard <richardc@andrew.cmu.edu>
Subject: Re: 3 questions

To cap off my own questions (refer to previous post to recall what they were):

1. https://blackboard.andrew.cmu.edu/bin/common/msg_view.pl?pk1=30948&;sos_id_pk2=1&context=default&nav=discussion_board2 (the posting w/ the header:
Current Forum: 15-211 Main Forum
Date: Sun Nov 4 2001 1:58 pm
Author: Shi, Ying <shy@cmu.edu>
Subject: streamtokenizer v.s. stringtokenizer
) is a thread w/ more about StreamTokenizer and StringTokenizer. To elaborate on that post, StreamTokenizer is in java.io which hints that it sits at the IO level and actually accepts an object of type InputStream which, in a ways, comes right from the file itself.

StringTokenizer is in java.util which hints that it is just a good/handy utility Sun wrote to help out Java programmers. StringTokenizer accepts a String in its constructor so you'd have to feed a StringTokenizer the String which you'd get from a StreamTokenizer which you'd get from an InputStream which, in a ways, comes right from the file itself.

2. This question relates closely to the 1 below (#3):

3. *Now* I understand why Java uses chars as represented by ints in the rang 0 to 65535 (0x00-0xffff) after reading www.unicode.org (Unicode is a standard for encoding text on computers).

For those who don't understand, the best way to explain is that unicode is the superset of ASCII. ASCII only encapsulates characters we typically see for English/Roman languages, Unicode does quacko stuff like Runic, Thai, Hangul (Korean), and other languages. I wouldn't be surprised if Klingon, as Dr. Lee mentioned, is probably in the standards-to-be :) Not a perfect analogy, though, but I try.

If anyone is still reading, I have 2 more questions (yep, I'm full of questions!):

1. The readLine() Dr. Lee mentioned is in java.io.BufferedReader, but if I used BufferedReader.readLine() (which returns an object of type String), wouldn't I still have to use StringTokenizer to break that line (String) returned into smaller tokens?

2. What advantage does reading a line at a time vs. reading token after token from java.io.String have?

HttpTokenizer.java already uses java.io.StreamTokenizer and its nextToken() method uses (String)sval which comes from (StringTokenizer)word. If I read in (String)line-by-line, I'd still have to break up each (String)line into individual (String)words which seems to be as (if not more) involved than that which HttpTokenizer already does.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
3 questions      Chen, Richard      Sun Nov 4 2001 1:24 am       
Re: 3 questions      Chen, Richard      Sun Nov 4 2001 1:30 am       
Re: 3 questions      Chen, Richard      Sun Nov 4 2001 4:02 am       
Re: 3 questions      Lee, Peter      Sun Nov 4 2001 11:05 am       
Re: 3 questions      Lee, Peter      Sun Nov 4 2001 11:07 am       
Re: 3 questions      Lee, Peter      Sun Nov 4 2001 11:04 am       
Re: 3 questions      Lee, Peter      Sun Nov 4 2001 11:03 am       
Re: 3 questions      Chen, Richard      Mon Nov 5 2001 6:43 pm       
Re: 3 questions      Lee, Peter      Mon Nov 5 2001 10:58 pm       

Back to previous screen