Package eu.simuline.octave.exec
Class OctaveWriterCallable
- java.lang.Object
-
- eu.simuline.octave.exec.OctaveWriterCallable
-
final class OctaveWriterCallable extends Object implements Callable<Void>
Callablethat writes scripts to the octave process. Used inOctaveExec.evalRW(WriteFunctor, ReadFunctor)only. This is complementary toOctaveReaderCallable.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOG(package private) static StringMSG_IOE_SPACER(package private) static StringMSG_IOE_WRITEprivate WriterprocessWriterThe writer for scripts passed to octave.private StringspacerA string essentially consisting of a unique hashvalue.private WriteFunctorwriteFunctorThe functor the writing task is delegated to.
-
Constructor Summary
Constructors Constructor Description OctaveWriterCallable(Writer processWriter, WriteFunctor writeFunctor, String spacer)Creates a new OctaveWriterCallable with methodcall()delegating writing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Voidcall()Calling writes toprocessWriterrepresenting the octave process: first according towriteFunctor, i.e. delegates toWriteFunctor.doWrites(Writer), then writesprintfofspacerand then flush.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
MSG_IOE_WRITE
static final String MSG_IOE_WRITE
- See Also:
- Constant Field Values
-
MSG_IOE_SPACER
static final String MSG_IOE_SPACER
- See Also:
- Constant Field Values
-
processWriter
private final Writer processWriter
The writer for scripts passed to octave. This is nothing butOctaveExec.processWriter.
-
writeFunctor
private final WriteFunctor writeFunctor
The functor the writing task is delegated to.
-
spacer
private final String spacer
A string essentially consisting of a unique hashvalue. It is printed toprocessWriterafter having appliedwriteFunctor. That way the accordingOctaveReaderCallabledetects the end of the read sequence from the octave process.
-
-
Constructor Detail
-
OctaveWriterCallable
OctaveWriterCallable(Writer processWriter, WriteFunctor writeFunctor, String spacer)
Creates a new OctaveWriterCallable with methodcall()delegating writing- Parameters:
processWriter- the writer used for writing.writeFunctor- the functor the writing process is delegated to.spacer- a string essentially consisting of a unique hashvalue printed after applying the write functor. This indicates the end of the sunbsequent according reading process inOctaveExec.evalRW(WriteFunctor, ReadFunctor).
-
-
Method Detail
-
call
public Void call()
Calling writes toprocessWriterrepresenting the octave process: first according towriteFunctor, i.e. delegates toWriteFunctor.doWrites(Writer), then writesprintfofspacerand then flush. That way,OctaveReaderCallable.call()knows, that reading is completed, as soon as the spacer is detected. Exceptions are logged onLOG.- Specified by:
callin interfaceCallable<Void>- Throws:
OctaveIOException- if the underlyingwriteFunctororprocessWriterthrows anIOException.
-
-