jsint
Class InputPort

java.lang.Object
  extended byjsint.InputPort
All Implemented Interfaces:
java.util.Enumeration

public class InputPort
extends java.lang.Object
implements java.util.Enumeration

InputPort is to Scheme as InputStream is to Java.

Author:
Peter Norvig, Copyright 1998, peter@norvig.com, license subsequently modified by Jscheme project members licensed under zlib licence (see license.txt)

Field Summary
 boolean brlsMode
           
static boolean defaultBrlsMode
           
static java.lang.Object EOF
          The distinguished end of file marking object.
 
Constructor Summary
InputPort(java.io.InputStream in)
          Construct an InputPort from an InputStream.
InputPort(java.io.Reader in)
          Construct an InputPort from a Reader.
InputPort(java.io.Reader in, boolean keepComments)
           
 
Method Summary
 java.lang.Object close()
          Close the port.
 int getLineNumber()
           
 boolean hasMoreElements()
           
static java.lang.Number negate(java.lang.Number n)
           
 java.lang.Object nextElement()
           
 java.lang.Object peekChar()
          Peek at and return the next Scheme character (or EOF).
 java.lang.Object read()
           
 java.lang.Object readChar()
          Read and return a Scheme character or EOF.
static java.lang.Number readFloatingPoint(java.lang.String s)
           
static java.lang.Number readWholeNumber(java.lang.String s)
           
static java.lang.Object schemeStringToNumber(java.lang.String tok, int rdx)
           
static java.lang.Object stringToNumber(java.lang.String tok, int rdx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EOF

public static final java.lang.Object EOF
The distinguished end of file marking object.


defaultBrlsMode

public static final boolean defaultBrlsMode
See Also:
Constant Field Values

brlsMode

public boolean brlsMode
Constructor Detail

InputPort

public InputPort(java.io.Reader in,
                 boolean keepComments)

InputPort

public InputPort(java.io.InputStream in)
Construct an InputPort from an InputStream.


InputPort

public InputPort(java.io.Reader in)
Construct an InputPort from a Reader.

Method Detail

readChar

public java.lang.Object readChar()
Read and return a Scheme character or EOF.


peekChar

public java.lang.Object peekChar()
Peek at and return the next Scheme character (or EOF). However, don't consume the character.


getLineNumber

public int getLineNumber()

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration

read

public java.lang.Object read()

close

public java.lang.Object close()
Close the port. Return TRUE if ok.


schemeStringToNumber

public static java.lang.Object schemeStringToNumber(java.lang.String tok,
                                                    int rdx)

stringToNumber

public static java.lang.Object stringToNumber(java.lang.String tok,
                                              int rdx)

readWholeNumber

public static java.lang.Number readWholeNumber(java.lang.String s)
                                        throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

negate

public static java.lang.Number negate(java.lang.Number n)

readFloatingPoint

public static java.lang.Number readFloatingPoint(java.lang.String s)
                                          throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException