Tea Java Runtime API
Version 3.1.0

com.pdmfc.tea.modules.io
Class SInput

java.lang.Object
  |
  +--com.pdmfc.tea.modules.tos.STosObj
        |
        +--com.pdmfc.tea.modules.io.SInput
All Implemented Interfaces:
SObjFunction
Direct Known Subclasses:
SFileInput, SUrlInput

public class SInput
extends STosObj

Instances of this class represent input streams.


Constructor Summary
SInput(STosClass myClass)
          The constructor initializes the object internal state.
 
Method Summary
 void close()
          Closes the underlying input stream.
 java.lang.Object close(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 java.lang.Object constructor(SObjFunction obj, SContext context, java.lang.Object[] args)
          The implementation for the constructor method.
 void copyTo(SContext context, STosObj out)
           
 int copyTo(SContext context, STosObj out, int total)
           
 java.lang.Object copyTo(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 void copyTo(SOutput out)
          Copies the remaining contents of the underlying input stream into the output stream received as argument.
 java.io.InputStream getInputStream()
          Fetches the underlying java.io.InputStream associated with this TInput.
static java.lang.String getTosClassName()
           
static SInput newInstance(SContext context)
           
 void open(java.io.InputStream in)
          Sets up the underlying stream.
 java.lang.String readln()
          Reads a line from the underlying input stream.
 java.lang.Object readln(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 
Methods inherited from class com.pdmfc.tea.modules.tos.STosObj
exec, getTosClass, init, part, selfObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SInput

public SInput(STosClass myClass)
       throws STeaException
The constructor initializes the object internal state.
Parameters:
myClass - The STosClass object for this object.
Method Detail

constructor

public java.lang.Object constructor(SObjFunction obj,
                                    SContext context,
                                    java.lang.Object[] args)
                             throws STeaException
The implementation for the constructor method.

open

public void open(java.io.InputStream in)
Sets up the underlying stream. One of the open() methods must be called prior to any invocation of the readln(), close() methods.
Parameters:
in - The InputStream associated with this object.

getInputStream

public java.io.InputStream getInputStream()
Fetches the underlying java.io.InputStream associated with this TInput.
Returns:
The java.io.InputStream specified in the last call to open(InputStream)

readln

public java.lang.Object readln(SObjFunction obj,
                               SContext context,
                               java.lang.Object[] args)
                        throws SIOException

readln

public java.lang.String readln()
                        throws java.io.IOException,
                               SIOException
Reads a line from the underlying input stream. The trailing end-of-line character is discarded. In case of an end-of-file condition a null is returned.
Returns:
A String containing a line read from the underlying input stream. When an end-of-file is reached a null is returned.
Throws:
SIOException - Thrown if the input stream is not opened.
java.io.IOException - Thrown if there were any problems reading from the stream.

copyTo

public java.lang.Object copyTo(SObjFunction obj,
                               SContext context,
                               java.lang.Object[] args)
                        throws STeaException

copyTo

public void copyTo(SOutput out)
            throws java.io.IOException,
                   SIOException
Copies the remaining contents of the underlying input stream into the output stream received as argument.

copyTo

public void copyTo(SContext context,
                   STosObj out)
            throws java.io.IOException,
                   STeaException

copyTo

public int copyTo(SContext context,
                  STosObj out,
                  int total)
           throws java.io.IOException,
                  STeaException
Parameters:
total - The maximum number of bytes to copy.
Returns:
The number of bytes that was actually copied.

close

public java.lang.Object close(SObjFunction obj,
                              SContext context,
                              java.lang.Object[] args)
                       throws SIOException

close

public void close()
           throws java.io.IOException
Closes the underlying input stream. From now on any attempt to call another method will result in an error.
Throws:
java.io.IOException - Throw if there where any problems while closing the input stream.

getTosClassName

public static java.lang.String getTosClassName()

newInstance

public static SInput newInstance(SContext context)
                          throws STeaException

Tea Java Runtime API
Version 3.1.0

© 2002 PDM&FC, All Rights Reserved.