Tea Java Runtime API
Version 3.1.0

com.pdmfc.tea.modules.io
Class SOutput

java.lang.Object
  |
  +--com.pdmfc.tea.modules.tos.STosObj
        |
        +--com.pdmfc.tea.modules.io.SOutput
All Implemented Interfaces:
SObjFunction
Direct Known Subclasses:
SFileOutput

public class SOutput
extends STosObj

Instances of this class represent output streams.


Constructor Summary
SOutput(STosClass myClass)
          The constructor initializes the object internal state.
 
Method Summary
 void close()
          Closes the underlying output 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)
           
 void flush()
          Flushes the underlying output stream.
 java.lang.Object flush(SObjFunction obj, SContext context, java.lang.Object[] args)
           
static java.lang.String getTosClassName()
           
static SOutput newInstance(SContext context)
           
 void open(java.io.OutputStream out)
          Sets up the underlying stream.
 java.lang.Object printf(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 void printf(java.lang.String formatString, java.lang.Object[] args, int firstArg)
          Send a string to the output.
 void setLineBuffering(boolean flag)
          Sets the buffering mode.
 java.lang.Object setLineBuffering(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 void write(byte[] buffer, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to the underlying output stream.
 void write(double value)
          Writes the decimal representation of a real value into the underlying output stream.
 void write(int value)
          Writes the decimal representation of an integer into the underlying output stream.
 void write(SObjByteArray bytes)
          Writes len bytes from the specified byte array starting at offset off to the underlying output stream.
 java.lang.Object write(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 void write(java.lang.String aString)
          Writes a string into the underlying output stream.
 void writeln()
           
 void writeln(double value)
          Writes the decimal representation of an real value into the underlying output stream with a trailing end-of-line.
 void writeln(int value)
          Writes the decimal representation of an integer value into the underlying output stream with a trailing end-of-line.
 java.lang.Object writeln(SObjFunction obj, SContext context, java.lang.Object[] args)
           
 void writeln(java.lang.String aString)
          Writes a string into the underlying output stream with a trailing end-of-line.
 
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

SOutput

public SOutput(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

open

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

setLineBuffering

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

setLineBuffering

public void setLineBuffering(boolean flag)
Sets the buffering mode. It can be either line buffering or fully bubeffring. When in line buffering mode, for every call to one of the writeln methods a flush will be performed.
Parameters:
flag - If true then line buffering should be used. Otherwise full beffering will be used.

write

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

write

public void write(byte[] buffer,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to the underlying output stream.

write

public void write(SObjByteArray bytes)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to the underlying output stream.

write

public void write(java.lang.String aString)
           throws java.io.IOException,
                  SIOException
Writes a string into the underlying output stream.
Parameters:
aString - The string to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if itwas closed.

write

public void write(int value)
           throws java.io.IOException,
                  SIOException
Writes the decimal representation of an integer into the underlying output stream.
Parameters:
value - The value to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if it was closed.

write

public void write(double value)
           throws java.io.IOException,
                  SIOException
Writes the decimal representation of a real value into the underlying output stream.
Parameters:
value - The value to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if it was closed.

writeln

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

writeln

public void writeln()
             throws java.io.IOException,
                    SIOException

writeln

public void writeln(java.lang.String aString)
             throws java.io.IOException,
                    SIOException
Writes a string into the underlying output stream with a trailing end-of-line.
Parameters:
aString - The string to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if it was closed.

writeln

public void writeln(int value)
             throws java.io.IOException,
                    SIOException
Writes the decimal representation of an integer value into the underlying output stream with a trailing end-of-line.
Parameters:
value - The value to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if it was closed.

writeln

public void writeln(double value)
             throws java.io.IOException,
                    SIOException
Writes the decimal representation of an real value into the underlying output stream with a trailing end-of-line.
Parameters:
value - The value to be output.
Throws:
SIOException - Thrown if the stream has not yet been opened or if it was closed.

printf

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

printf

public void printf(java.lang.String formatString,
                   java.lang.Object[] args,
                   int firstArg)
            throws java.io.IOException,
                   SIOException,
                   STypeException,
                   SNumArgException
Send a string to the output. The string is build from a "printf" like format string.
Parameters:
formatString - The "printf" like format string.
args - Array of objects that may be referenced by the format string.
firstArg - Index into the args array referencing the first element of the array that will be used from the format string.

flush

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

flush

public void flush()
           throws java.io.IOException,
                  SIOException
Flushes the underlying output stream.
Throws:
SIOException - Thrown if there were problems flushing the stream or if the stream has not yet been opened or if it was closed.

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 output 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 SOutput newInstance(SContext context)
                           throws STeaException

Tea Java Runtime API
Version 3.1.0

© 2002 PDM&FC, All Rights Reserved.