Java - StreamTokenizer

From: Merlin (merlin_at_pheonix.fsnet.co.uk)
Date: 06/24/04


Date: Thu, 24 Jun 2004 17:31:10 +0100

Hi everyone, I was wondering if anyone would be kind enough to answer a
question on the StreamTokenizer class. As part of my efforts to learn java
i'm writing a class that parses my BlackICE firewall logs. Below is part of
the constructor that i've written so far:

      Code:
      public LogParser(String inputFile) throws FileNotFoundException,
IOException
      {
              BufferedReader br = new BufferedReader(new
FileReader(inputFile));
              StreamTokenizer st = new StreamTokenizer(br);

              st.eolIsSignificant(true);
              st.commentChar('#');

              st.nextToken();
      }

Now I've used to commentChar() method because I want all lines beginning
with a hash to be ignored. The first line in my log starts with a hash so as
stated in the java api I would expect nextToken() to read this and go to the
end of the line. So next when I run nextToken() it should pick up some text
that is on the next line. Yet when I try to output the contents of the token
by say System.out.println(st.sval) I get the value null. Any help with my
stupidity would be appreciated.



Relevant Pages

  • Re: Performance of hash_set vs. Java
    ... Some native Java features can be more efficient ... a custom hash function as an additional parameter. ... > that my hash function may be slow from the call to c_str. ... reading code and hash table, so we can't really help there. ...
    (comp.lang.cpp)
  • Re: HMAC and timing
    ... Benchmarking in Java is a bit tricky, ... If you want a measure with about 1% accuracy, you have to hash ... kernel and its cache subsystem. ... the CPU cache. ...
    (sci.crypt)
  • Re: Encryption -- Blowfish limited to 8 byte passowrds?
    ... Chris wrote: ... Why won't Java allow other length ... > some kind of hash function. ... > algorithm itself is only acting on an 8-byte key. ...
    (comp.lang.java)
  • Re: Performance of hash_set vs. Java
    ... The main benefit Java has in hashing is that Strings cache their ... >that my hash function may be slow from the call to c_str. ... The above code may be where your main bottleneck is. ...
    (comp.lang.cpp)
  • Re: Verifying a Java Signature using LDAP fails...
    ... Generic Java 2 and .NET generated standard bog-endian-ordered pkcs #1 signature ... bytes as above (assume you hash identical data bytes with same hash algorithm specified) ... The public key is stored in binary form on an LDAP server ... > I then create a Hash of the signed data and try to verify it with CryptVerifySignature which fails ...
    (microsoft.public.platformsdk.security)