com.parctechnologies.eclipse
Class EXDROutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bycom.parctechnologies.eclipse.EXDROutputStream

public class EXDROutputStream
extends java.io.FilterOutputStream

A stream which can write EXDR format. An EXDROutputStream can be constructed from any instance of the OutputStream class and extends it to be able to write outgoing data in the EXDR (ECLiPSe eXternal Data Representation) format.

Use the method write(Object) to convert Java CompoundTerm objects and instances of other relevant Java classes into EXDR format so that data can be read in by ECLiPSe.

EXDROutputStream also uses a buffer: rather than writing to the underlying OutputStream byte-by-byte, EXDR data is written to the buffer and then copied to the OutputStream when a whole term has been completed.

Note that EXDROutputStream objects are often constructed using ToEclipseQueues.

See Also:
CompoundTerm, ToEclipseQueue

Constructor Summary
EXDROutputStream(java.io.OutputStream s)
          Construct an EXDROutputStream which will write EXDR to a named OutputStream.
EXDROutputStream(java.io.OutputStream s, boolean compressStrings)
          Construct an EXDROutputStream which will write EXDR with optionally compressed strings to a named OutputStream.
 
Method Summary
 void enableCompression(boolean compress)
          Enable / disable string compression for subsequently written terms.
 void flush()
          Flushes the underlying OutputStream.
 void write(java.lang.Object o)
          Write an Object to the underlying stream in EXDR format.
 
Methods inherited from class java.io.FilterOutputStream
close, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EXDROutputStream

public EXDROutputStream(java.io.OutputStream s)
Construct an EXDROutputStream which will write EXDR to a named OutputStream.


EXDROutputStream

public EXDROutputStream(java.io.OutputStream s,
                        boolean compressStrings)
Construct an EXDROutputStream which will write EXDR with optionally compressed strings to a named OutputStream.

Method Detail

write

public void write(java.lang.Object o)
           throws java.io.IOException
Write an Object to the underlying stream in EXDR format. The Object (or if it is a compound term, its arguments, nested however deep) can be of any of the following acceptable EXDR output types: This is an atomic action, so that different threads writing to the same stream do not garble the data.

Throws:
java.lang.IllegalArgumentException - if the parameter is of an unrecognised class, or if Not-a-number (NaN)-valued Floats or Doubles are supplied.
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes the underlying OutputStream.

Throws:
java.io.IOException

enableCompression

public void enableCompression(boolean compress)
Enable / disable string compression for subsequently written terms.