Yes, that's true, you can do that. (That's the first thing the Sun rep told
me to do).
But it's not that simple.
Try and replace the nextToken(). In your new nextToken() method, you want to
check to see if the character you read in is a quote. (The programmer sets
the quote character using the quoteChar() method.) You can't. The value
is kept in the ctype array, and you can't sublass StreamTokenizer and get at
that array since it's private. In fact, nearly all the variables are
private. There are no accessor methods to the private variables. You'd have
to duplicate nearly everything they've made private, and at that point it's
better to just rewrite the class to add the additional functionality you want.
I looked up my notes on this, and it was reported to Sun in September of 1997.
I suppose you can subclass StreamTokenizer and then read things in as strings
and paste things together, and re-evalute them, you can do that. Read
everything in as a string, then on each token re-examine it to see if it is
really just a string, or if it's a integer, or float, or exponential number,
or hex number, or whatever. I wanted to have something that was functionally
equivalent to StreamTokenizer, but with additional abilities, and something
that was quick. So I had to rewrite it.
Steve
"Andrew R. Thomas-Cramer" wrote:
> Perhaps I'm interpreting your second sentence too literally. If not, let me
> note that the line below is functioning code in our application:
>
> private static class Tokenizer extends java.io.StreamTokenizer {
>
> -----Original Message-----
> From: Steve Pietrowicz <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Date: Monday, November 15, 1999 4:51 PM
> Subject: Re: [JAVA3D] reading arrays of exponential floating point numbers
>
> >I ran into this problem a long time ago. StreamTokenizer can't be
> subclassed,
> >because of the way the class is set up. A bug has been submitted to Sun
> about
> >this, but I haven't heard anything. It's been over a year.
> >
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
Steve Pietrowicz - [EMAIL PROTECTED]
NCSA Portfolio 1.3 beta 3: http://www.ncsa.uiuc.edu/~srp/Java3D/portfolio/
New Loaders, turn your Canvas3D into a JPEG, new InputDevices and more!
Freely available for non-commercial use!
You Build It VR: http://www.ncsa.uiuc.edu/~srp/Java3D/YouBuildItVR/
Build your own multi-user virtual worlds with no programming experience!
The Java3D FAQ: http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
Astro3D: Java 3D Astronomy - http://www.ncsa.uiuc.edu/~srp/Java3D/Astro3D/
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".