Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.opencyc.api
Class CfaslInputStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--java.io.FilterInputStream
                  |
                  +--java.io.BufferedInputStream
                        |
                        +--org.opencyc.api.CfaslInputStream

public class CfaslInputStream
extends java.io.BufferedInputStream

A CFASL translating input stream. All Java-native types which have logical sublisp equivalents are translated automatically by this stream. Classes implementing the CfaslTranslatingObject interface are created using thier readObject() method. Other CYC objects, such as binding-lists and formulas, must be explicitly coerced using their static constructors.

Author:
  Stephen L. Reed

  Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

  the license

  www.opencyc.org

  OpenCyc at SourceForge

  THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Field Summary
`static int` | `API_TRACE_DETAILED` Detailed api trace.
`static int` | `API_TRACE_MESSAGES` Message-level api trace.
`static int` | `API_TRACE_NONE` No api trace.
`protected static int` | `CFASL_ASSERTION`
`protected static int` | `CFASL_ASSERTION_DEF`
`protected static int` | `CFASL_ASSERTION_SHELL`
`protected static int` | `CFASL_AXIOM`
`protected static int` | `CFASL_AXIOM_DEF`
`protected static int` | `CFASL_BTREE_HIGH`
`protected static int` | `CFASL_BTREE_LEAF`
`protected static int` | `CFASL_BTREE_LOW`
`protected static int` | `CFASL_BTREE_LOW_HIGH`
`protected static int` | `CFASL_BYTE_VECTOR`
`protected static int` | `CFASL_CHARACTER`
`protected static int` | `CFASL_CONSTANT`
`protected static int` | `CFASL_DICTIONARY`
`protected static int` | `CFASL_DOTTED`
`protected static int` | `CFASL_GUID`
`protected static int` | `CFASL_HASHTABLE`
`protected static int` | `CFASL_IMMEDIATE_FIXNUM_CUTOFF`
`protected static int` | `CFASL_IMMEDIATE_FIXNUM_OFFSET`
`protected static int` | `CFASL_INDEX`
`protected static int` | `CFASL_KEYWORD`
`protected static int` | `CFASL_LIST`
`protected static int` | `CFASL_N_16BIT_INT`
`protected static int` | `CFASL_N_24BIT_INT`
`protected static int` | `CFASL_N_32BIT_INT`
`protected static int` | `CFASL_N_8BIT_INT`
`protected static int` | `CFASL_N_BIGNUM`
`protected static int` | `CFASL_N_FLOAT`
`protected static int` | `CFASL_NART`
`protected static int` | `CFASL_NIL`
`protected static int` | `CFASL_P_16BIT_INT`
`protected static int` | `CFASL_P_24BIT_INT`
`protected static int` | `CFASL_P_32BIT_INT`
`protected static int` | `CFASL_P_8BIT_INT`
`protected static int` | `CFASL_P_BIGNUM`
`protected static int` | `CFASL_P_FLOAT`
`protected static int` | `CFASL_SERVER_DEATH`
`protected static int` | `CFASL_SOURCE`
`protected static int` | `CFASL_SOURCE_DEF`
`protected static int` | `CFASL_SPECIAL_OBJECT`
`protected static int` | `CFASL_STRING`
`protected static int` | `CFASL_SYMBOL`
`protected static int` | `CFASL_VARIABLE`
`protected static int` | `CFASL_VECTOR`
`protected static int` | `DEFAULT_READ_LIMIT`
`boolean` | `reportCfaslErrors` Parameter that when set true, causes CFASL object errors to be reported back as strings the caller.
`int` | `trace` Parameter that, when true, causes a trace of the messages to and from the server.

Fields inherited from class java.io.BufferedInputStream
`buf, count, marklimit, markpos, pos`

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`CfaslInputStream(java.io.InputStream in)` Creates a new CfaslInputStream to read data from the specified underlying input stream.

Method Summary
`protected void` | `initializeOpcodeDescriptions()` Initializes the opcode descriptions used in trace output.
`CycAssertion` | `readAssertion()` Reads an assertion from a CfaslInputStream.
`ByteArray` | `readByteArray()` Reads a byte vector from the CfaslInputStream.
`char` | `readChar()` Reads an char from this CfaslInputStream.
`CycList` | `readCons()` Reads a dotted list from the CfaslInputStream.
`CycConstant` | `readConstant()` Reads a constant from a CfaslInputStream.
`CycList` | `readCycList()` Reads a list from the CfaslInputStream.
`double` | `readDouble()` Reads a double from this CfaslInputStream.
`Guid` | `readGuid()` Reads the body of a Guid from the CfaslInputStream.
`int` | `readInt()` Reads an int from this CfaslInputStream.
`CycSymbol` | `readKeyword()` Reads the body of a keyword Symbol from the CfaslInputStream.
`CycNart` | `readNart()` Reads a NART from a CfaslInputStream.
`java.lang.Object` | `readObject()` Reads an Object from this CfaslInputStream.
`java.lang.Object` | `readSymbol()` Reads the body of a Symbol or EL variable from the CfaslInputStream.
`CycVariable` | `readVariable()` Reads a variable from the CfaslInputStream.
`protected java.lang.Object` | `reportUnhandledCfaslOpcode(int cfaslOpcode)` Reports the unhandled cfasl opcode or throws an exception.

Methods inherited from class java.io.BufferedInputStream
`available, close, mark, markSupported, read, read, reset, skip`

Methods inherited from class java.io.FilterInputStream
`read`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### API_TRACE_NONE

    public static final int API_TRACE_NONE

  No api trace.

### API_TRACE_MESSAGES

    public static final int API_TRACE_MESSAGES

  Message-level api trace.

### API_TRACE_DETAILED

    public static final int API_TRACE_DETAILED

  Detailed api trace.

### trace

    public int trace

  Parameter that, when true, causes a trace of the messages to and from the server.

### reportCfaslErrors

    public boolean reportCfaslErrors

  Parameter that when set true, causes CFASL object errors to be reported back as strings the caller.

### CFASL_IMMEDIATE_FIXNUM_CUTOFF

    protected static final int CFASL_IMMEDIATE_FIXNUM_CUTOFF

### CFASL_IMMEDIATE_FIXNUM_OFFSET

    protected static final int CFASL_IMMEDIATE_FIXNUM_OFFSET

### CFASL_P_8BIT_INT

    protected static final int CFASL_P_8BIT_INT

### CFASL_N_8BIT_INT

    protected static final int CFASL_N_8BIT_INT

### CFASL_P_16BIT_INT

    protected static final int CFASL_P_16BIT_INT

### CFASL_N_16BIT_INT

    protected static final int CFASL_N_16BIT_INT

### CFASL_P_24BIT_INT

    protected static final int CFASL_P_24BIT_INT

### CFASL_N_24BIT_INT

    protected static final int CFASL_N_24BIT_INT

### CFASL_P_32BIT_INT

    protected static final int CFASL_P_32BIT_INT

### CFASL_N_32BIT_INT

    protected static final int CFASL_N_32BIT_INT

### CFASL_P_FLOAT

    protected static final int CFASL_P_FLOAT

### CFASL_N_FLOAT

    protected static final int CFASL_N_FLOAT

### CFASL_KEYWORD

    protected static final int CFASL_KEYWORD

### CFASL_SYMBOL

    protected static final int CFASL_SYMBOL

### CFASL_NIL

    protected static final int CFASL_NIL

### CFASL_LIST

    protected static final int CFASL_LIST

### CFASL_DOTTED

    protected static final int CFASL_DOTTED

### CFASL_VECTOR

    protected static final int CFASL_VECTOR

### CFASL_STRING

    protected static final int CFASL_STRING

### CFASL_CHARACTER

    protected static final int CFASL_CHARACTER

### CFASL_HASHTABLE

    protected static final int CFASL_HASHTABLE

### CFASL_BTREE_LOW_HIGH

    protected static final int CFASL_BTREE_LOW_HIGH

### CFASL_BTREE_LOW

    protected static final int CFASL_BTREE_LOW

### CFASL_BTREE_HIGH

    protected static final int CFASL_BTREE_HIGH

### CFASL_BTREE_LEAF

    protected static final int CFASL_BTREE_LEAF

### CFASL_P_BIGNUM

    protected static final int CFASL_P_BIGNUM

### CFASL_N_BIGNUM

    protected static final int CFASL_N_BIGNUM

### CFASL_GUID

    protected static final int CFASL_GUID

### CFASL_BYTE_VECTOR

    protected static final int CFASL_BYTE_VECTOR

### CFASL_CONSTANT

    protected static final int CFASL_CONSTANT

### CFASL_NART

    protected static final int CFASL_NART

### CFASL_ASSERTION

    protected static final int CFASL_ASSERTION

### CFASL_ASSERTION_SHELL

    protected static final int CFASL_ASSERTION_SHELL

### CFASL_ASSERTION_DEF

    protected static final int CFASL_ASSERTION_DEF

### CFASL_SOURCE

    protected static final int CFASL_SOURCE

### CFASL_SOURCE_DEF

    protected static final int CFASL_SOURCE_DEF

### CFASL_AXIOM

    protected static final int CFASL_AXIOM

### CFASL_AXIOM_DEF

    protected static final int CFASL_AXIOM_DEF

### CFASL_VARIABLE

    protected static final int CFASL_VARIABLE

### CFASL_INDEX

    protected static final int CFASL_INDEX

### CFASL_SPECIAL_OBJECT

    protected static final int CFASL_SPECIAL_OBJECT

### CFASL_DICTIONARY

    protected static final int CFASL_DICTIONARY

### CFASL_SERVER_DEATH

    protected static final int CFASL_SERVER_DEATH

### DEFAULT_READ_LIMIT

    protected static final int DEFAULT_READ_LIMIT

Constructor Detail

### CfaslInputStream

    public CfaslInputStream(java.io.InputStream in)

  Creates a new CfaslInputStream to read data from the specified underlying input stream.
  Parameters:
    `in` - the underlying input stream.

Method Detail

### initializeOpcodeDescriptions

    protected void initializeOpcodeDescriptions()

  Initializes the opcode descriptions used in trace output.

### readObject

    public java.lang.Object readObject()
                                throws java.io.IOException

  Reads an Object from this CfaslInputStream. Basic Java types are wrapped as appropriate (e.g. ints become Integer objects). New constants are missing name and GUID values and will be completed by the caller to avoid recursion within the api call.
  Returns:
    the object read from the binary OpenCyc input stream

### reportUnhandledCfaslOpcode

    protected java.lang.Object reportUnhandledCfaslOpcode(int cfaslOpcode)

  Reports the unhandled cfasl opcode or throws an exception.

### readChar

    public char readChar()
                  throws java.io.IOException

  Reads an char from this CfaslInputStream. If the next item on the stream is not a char, throw an exception, and leave that object on the input stream.
  Returns:
    the character read

### readDouble

    public double readDouble()
                      throws java.io.IOException

  Reads a double from this CfaslInputStream. If the next item on the stream is not a double, throw an exception, and leave that object on the input stream.
  Returns:
    the double read

### readInt

    public int readInt()
                throws java.io.IOException

  Reads an int from this CfaslInputStream. If the next item on the stream is not an int, throw an exception, and leave that object on the input stream. Bignum ints are not allowed.
  Returns:
    the int read

### readKeyword

    public CycSymbol readKeyword()
                          throws java.io.IOException

  Reads the body of a keyword Symbol from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the keyword `CycSymbol` read

### readSymbol

    public java.lang.Object readSymbol()
                                throws java.io.IOException

  Reads the body of a Symbol or EL variable from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the `CycSymbol` or EL `CycVariable`

### readGuid

    public Guid readGuid()
                  throws java.io.IOException

  Reads the body of a Guid from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the `Guid` read

### readByteArray

    public ByteArray readByteArray()
                            throws java.io.IOException

  Reads a byte vector from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the `ByteArray` read

### readCycList

    public CycList readCycList()
                        throws java.io.IOException

  Reads a list from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the `CycList` read

### readCons

    public CycList readCons()
                     throws java.io.IOException

  Reads a dotted list from the CfaslInputStream. The CFASL opcode has already been read in at this point, so we only read in what follows.
  Returns:
    the `CycList` read

### readConstant

    public CycConstant readConstant()
                             throws java.io.IOException

  Reads a constant from a CfaslInputStream.
  Returns:
    an incomplete `CycConstant` having the input id

### readVariable

    public CycVariable readVariable()
                             throws java.io.IOException

  Reads a variable from the CfaslInputStream.
  Returns:
    an incomplete `CycVariable` having the input id

### readNart

    public CycNart readNart()
                     throws java.io.IOException

  Reads a NART from a CfaslInputStream.
  Returns:
    an incomplete `CycConstant` having the input id

### readAssertion

    public CycAssertion readAssertion()
                               throws java.io.IOException

  Reads an assertion from a CfaslInputStream.
  Returns:
    an incomplete `CycAssertion` having the input id

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD