Package eu.simuline.octave.exec
Class OctaveReaderCallable
- java.lang.Object
-
- eu.simuline.octave.exec.OctaveReaderCallable
-
final class OctaveReaderCallable extends Object implements Callable<Void>
Callablethat reads from the octave process. Used inOctaveExec.evalRW(WriteFunctor, ReadFunctor)only. This is complementary toOctaveWriterCallable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classOctaveReaderCallable.OctaveExecuteReaderReader that passes the reading on to the output from the octave process, i.e. fromprocessReaderuntil the spacerspacerreached, then it returns EOF.
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOGprivate static StringMSG_IOE_CLSprivate static StringMSG_IOE_READprivate BufferedReaderprocessReaderThe reader for feedback on scripts received from octave.private ReadFunctorreadFunctorThe functor the reading task is delegated to.private StringspacerA string essentially consisting of a unique hashvalue.
-
Constructor Summary
Constructors Constructor Description OctaveReaderCallable(BufferedReader processReader, ReadFunctor readFunctor, String spacer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Voidcall()Calling essentially reads fromprocessReaderrepresenting the octave process: Reads untilspaceris detected which is not really read but is interpreted as an eof symbol.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
MSG_IOE_READ
private static final String MSG_IOE_READ
- See Also:
- Constant Field Values
-
MSG_IOE_CLS
private static final String MSG_IOE_CLS
- See Also:
- Constant Field Values
-
processReader
private final BufferedReader processReader
The reader for feedback on scripts received from octave. This is nothing butOctaveExec.processReader.
-
readFunctor
private final ReadFunctor readFunctor
The functor the reading task is delegated to.
-
spacer
private final String spacer
A string essentially consisting of a unique hashvalue. It has been printed by the accordingOctaveWriterCallableafter having applied the write functor and thus indicates the end of the read sequence of the octave process.
-
-
Constructor Detail
-
OctaveReaderCallable
OctaveReaderCallable(BufferedReader processReader, ReadFunctor readFunctor, String spacer)
- Parameters:
processReader- the reader used for reading.readFunctor- the functor the reading process is delegated to.spacer- a string essentially consisting of a unique hashvalue printed at the end of the according write process inOctaveExec.evalRW(WriteFunctor, ReadFunctor)and thus signifying the end of the sequence to be read.
-
-
Method Detail
-
call
public Void call()
Calling essentially reads fromprocessReaderrepresenting the octave process: Reads untilspaceris detected which is not really read but is interpreted as an eof symbol. To that end,processReaderis wrapped into anOctaveReaderCallable.OctaveExecuteReaderwith parameterspacerwhich yields eof if the spacer is detected. Closing theOctaveReaderCallable.OctaveExecuteReaderreads the spacer without passing it further. Exceptions are logged onLOG.- Specified by:
callin interfaceCallable<Void>- Throws:
OctaveIOException- if underlyingreadFunctoror the readerprocessReaderor the wrappingOctaveReaderCallable.OctaveExecuteReaderthrows anIOException.
-
-