iicm.vrml.pw
Class StrTokenizer

java.lang.Object
  extended by iicm.vrml.pw.StrTokenizer

public class StrTokenizer
extends java.lang.Object

StrTokenizer - read VRML stream tokens Copyright (c) 1997 IICM

Version:
1.0.2, latest change: 18 Feb 97
Author:
Michael Pichler

Field Summary
private  byte[] backbuf_
           
private  int backoffs_
           
private  int buffered_
           
private  int c_
           
private  CharArray commentBuffer
           
private  java.io.InputStream in_
           
private  int lineno_
           
private  int optsize
           
 
Constructor Summary
StrTokenizer(java.io.InputStream is)
          construct a StrTokenizer for an InputStream.
 
Method Summary
 boolean eof()
          return flag whether end of file was reached
private  int getChar()
          get next character from stream or backbuffer (internal)
 int lineno()
          current line number
 int nextChar()
          look at next character without reading a new one.
(package private)  java.lang.String OutputComment()
          OutputComment outputs the commen.
 void putbackString(java.lang.String s)
          put back a String.
 int readChar()
          read a character (skips whitespace and comments)
 double readFloatValue()
          read a floating point number. format: [+-][0-9]*{[.][0-9]*}{[Ee][+-][0-9]*}
 java.lang.String readIdentifier()
          read an identifier String (skips whitespace and comments)
 int readIntValue()
          read an integer. format: [+-][0-9]* or [+-]0x[0-9A-Fa-f]*
 int readLine(char[] buf)
          read a whole line (until \r or \n) into a char[] buffer.
 java.lang.String readQuotedString()
          read a quoted String ("...").
 void skipComment()
          skip any amount of whitespace - handle any comment.
(package private)  boolean skipCommentReturn(boolean arg)
          call skipComment and return the argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in_

private java.io.InputStream in_

optsize

private final int optsize
See Also:
Constant Field Values

backbuf_

private byte[] backbuf_

buffered_

private int buffered_

backoffs_

private int backoffs_

c_

private int c_

lineno_

private int lineno_

commentBuffer

private CharArray commentBuffer
Constructor Detail

StrTokenizer

public StrTokenizer(java.io.InputStream is)
construct a StrTokenizer for an InputStream. StrTokenizer does buffering on the input stream. current implementation blocks to read first character from stream

Method Detail

eof

public boolean eof()
return flag whether end of file was reached


lineno

public int lineno()
current line number


nextChar

public int nextChar()
look at next character without reading a new one. returns -1 on eof

See Also:
skipComment()

getChar

private final int getChar()
                   throws java.io.IOException
get next character from stream or backbuffer (internal)

Throws:
java.io.IOException

skipComment

public void skipComment()
                 throws java.io.IOException
skip any amount of whitespace - handle any comment. called by all read operations

Throws:
java.io.IOException

OutputComment

java.lang.String OutputComment()
                         throws java.io.IOException
OutputComment outputs the commen. Invoke between nodes and not inside field attributes.

Throws:
java.io.IOException

skipCommentReturn

boolean skipCommentReturn(boolean arg)
                    throws java.io.IOException
call skipComment and return the argument. java has no comma operator for loop conditions

Throws:
java.io.IOException

readLine

public int readLine(char[] buf)
             throws java.io.IOException
read a whole line (until \r or \n) into a char[] buffer. if the line is longer than the buffer, the rest is skipped. the newline character is not appended to the buffer

Returns:
the no. of chars written into buf
Throws:
java.io.IOException

readChar

public int readChar()
             throws java.io.IOException
read a character (skips whitespace and comments)

Returns:
character or -1 on EOF
Throws:
java.io.IOException

readIdentifier

public java.lang.String readIdentifier()
                                throws java.io.IOException
read an identifier String (skips whitespace and comments)

Returns:
null if no identifier could be read or non-zero length identifier string
Throws:
java.io.IOException

readQuotedString

public java.lang.String readQuotedString()
                                  throws java.io.IOException
read a quoted String ("..."). the quotes themselves are not part of the String returned. returns empty string if next char is not '"'

Throws:
java.io.IOException

readIntValue

public int readIntValue()
                 throws java.io.IOException
read an integer. format: [+-][0-9]* or [+-]0x[0-9A-Fa-f]*

Throws:
java.io.IOException

readFloatValue

public double readFloatValue()
                      throws java.io.IOException
read a floating point number. format: [+-][0-9]*{[.][0-9]*}{[Ee][+-][0-9]*}

Throws:
java.io.IOException

putbackString

public void putbackString(java.lang.String s)
put back a String. In order to not further slow down reading of numbers, their string representation is not remembered by this class