com.svincent.moksa
Class Io.PrologInput

java.lang.Object
  |
  +--com.svincent.moksa.WamObject
        |
        +--com.svincent.moksa.PrologTerm
              |
              +--com.svincent.moksa.Io.StreamIdentifier
                    |
                    +--com.svincent.moksa.Io.PrologInput
All Implemented Interfaces:
Trailable
Direct Known Subclasses:
Io.PrologInputStream, Io.PrologReader
Enclosing class:
Io

public abstract static class Io.PrologInput
extends Io.StreamIdentifier

An identifier for an input stream.


Fields inherited from class com.svincent.moksa.PrologTerm
EmptyArray
 
Constructor Summary
Io.PrologInput(Io _io, java.lang.String _fileName, CompoundTerm _options)
          Opens the file.
 
Method Summary
abstract  void close()
           
 void consume(int c)
          If 'c' is the next character in the stream, read and discard it.
 void flush()
           
 int getMode()
           
 boolean isInput()
           
 boolean lookahead(int n, int c)
          Returns 'true' iff the character 'c' is 'n' characters ahead in this stream.
 int peekChar()
          Returns the character which will be returned from the next call to 'readChar'.
 int peekChar(int n)
          Peeks n chars ahead.
 void pushbackChar(int c)
          Pushes a character back into the stream.
 int readChar()
          Reads a character from this stream.
abstract  int readCharImpl()
           
 PrologTerm readCharTerm()
          Returns the next character in the stream as a PrologTerm (either an Integer or an Atom: 'end_of_file').
 
Methods inherited from class com.svincent.moksa.Io.StreamIdentifier
clonePrologTerm, getName, getOptions, getUri, isOpen, isOutput, isStreamId, unify
 
Methods inherited from class com.svincent.moksa.PrologTerm
accept, clonePrologTerm, deref, evaluateExpression, floatValue, getArity, getNameConstant, getPriority, intValue, isAtom, isCompoundTerm, isConstant, isEmptyList, isFloat, isInteger, isJavaObject, isList, isNonEmptyList, isStructure, isVariable, printVariables, setPriority, unify, unifyWithoutBindings, untrail
 
Methods inherited from class com.svincent.moksa.WamObject
tag, tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Io.PrologInput

public Io.PrologInput(Io _io,
                      java.lang.String _fileName,
                      CompoundTerm _options)
Opens the file.
Method Detail

getMode

public int getMode()
Overrides:
getMode in class Io.StreamIdentifier

isInput

public boolean isInput()
Overrides:
isInput in class Io.StreamIdentifier

readCharImpl

public abstract int readCharImpl()
                          throws java.io.IOException

close

public abstract void close()
                    throws java.io.IOException
Overrides:
close in class Io.StreamIdentifier

readCharTerm

public PrologTerm readCharTerm()
                        throws java.io.IOException
Returns the next character in the stream as a PrologTerm (either an Integer or an Atom: 'end_of_file').

peekChar

public int peekChar()
             throws java.io.IOException
Returns the character which will be returned from the next call to 'readChar'.


peekChar

public int peekChar(int n)
             throws java.io.IOException
Peeks n chars ahead.

peekChar (1) == peekChar ()


consume

public void consume(int c)
             throws java.io.IOException
If 'c' is the next character in the stream, read and discard it. If it is not, do not read it, and throw an exception.

lookahead

public boolean lookahead(int n,
                         int c)
                  throws java.io.IOException
Returns 'true' iff the character 'c' is 'n' characters ahead in this stream.

pushbackChar

public void pushbackChar(int c)
                  throws java.io.IOException
Pushes a character back into the stream. This character will be read again later.

XXX export this functionality to Prolog.


readChar

public int readChar()
             throws java.io.IOException
Reads a character from this stream.

flush

public void flush()
           throws java.io.IOException
Overrides:
flush in class Io.StreamIdentifier



This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/

Copyright © 1999 Shawn P. Vincent.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.