Package com.parctechnologies.eclipse
Class EXDROutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.parctechnologies.eclipse.EXDROutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
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:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct an EXDROutputStream which will write EXDR to a named OutputStream.EXDROutputStream(OutputStream s, boolean compressStrings) Construct an EXDROutputStream which will write EXDR with optionally compressed strings to a named OutputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidenableCompression(boolean compress) Enable / disable string compression for subsequently written terms.voidflush()Flushes the underlying OutputStream.voidWrite an Object to the underlying stream in EXDR format.Methods inherited from class java.io.FilterOutputStream
close, write, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
EXDROutputStream
Construct an EXDROutputStream which will write EXDR to a named OutputStream. -
EXDROutputStream
Construct an EXDROutputStream which will write EXDR with optionally compressed strings to a named OutputStream.
-
-
Method Details
-
write
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:null- this is interpreted as a variable in ECLiPSe.- String objects.
- Anything implementing the CompoundTerm interface whose arguments are also instances of acceptable EXDR output types.
- Integer objects.
- Double or Float objects: these are interpreted as floats on the ECLiPSe side. Note that attempts to write Not-a-number (NaN) will raise an IllegalArgumentException.
- Any object implementing the Collection interface whose elements are all instances of acceptable EXDR output types. The collection is interpreted as an ECLiPSe list.
- Throws:
IllegalArgumentException- if the parameter is of an unrecognised class, or if Not-a-number (NaN)-valued Floats or Doubles are supplied.IOException
-
flush
Flushes the underlying OutputStream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-
enableCompression
public void enableCompression(boolean compress) Enable / disable string compression for subsequently written terms.
-