Re: How does StreamTokenizer work

Discussion in 'Java' started by John C. Bollinger, Jun 30, 2003.

  1. Dave Rathnow wrote:
    > I have a text string of hex values separated by
    > whitespaces and I would like to read them using a
    > StreamTokenizer. For example:
    >
    > String hexString = "0b ab ff 33 56"
    >
    > I've been trying to figure out how to do it but haven't
    > had any luck. Can someone tell me how I setup a StreamTokenizer
    > to give me each hex value? That is, "0b" then "ab" then "ff"
    > etc.


    Wrap your hex string in a StringReader and feed it to the
    StreamTokenizer. Set the decimal digit characters to be ordinary, and
    then to be word characters. (That combination removes the "numeric"
    attribute from those characters.) Happy parsing.


    John Bollinger
    John C. Bollinger, Jun 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. D. Lane
    Replies:
    1
    Views:
    2,472
    Dave Rathnow
    Jun 30, 2003
  2. Sudsy

    Re: StreamTokenizer

    Sudsy, Jul 24, 2003, in forum: Java
    Replies:
    2
    Views:
    504
    Sudsy
    Aug 2, 2003
  3. Ian deSouza

    Re: StreamTokenizer

    Ian deSouza, Aug 1, 2003, in forum: Java
    Replies:
    0
    Views:
    1,550
    Ian deSouza
    Aug 1, 2003
  4. Lordy
    Replies:
    1
    Views:
    367
    Dale King
    Jun 11, 2006
  5. Replies:
    7
    Views:
    617
    John B. Matthews
    Sep 21, 2008
Loading...

Share This Page