Package eu.simuline.octave.exec
Class OctaveReaderCallable
- java.lang.Object
-
- eu.simuline.octave.exec.OctaveReaderCallable
-
final class OctaveReaderCallable extends Object implements Callable<Void>
Callable
that 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) class
OctaveReaderCallable.OctaveExecuteReader
Reader that passes the reading on to the output from the octave process, i.e. fromprocessReader
until the spacerspacer
reached, then it returns EOF.
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.Log
LOG
private static String
MSG_IOE_CLS
private static String
MSG_IOE_READ
private BufferedReader
processReader
The reader for feedback on scripts received from octave.private ReadFunctor
readFunctor
The functor the reading task is delegated to.private String
spacer
A 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 Void
call()
Calling essentially reads fromprocessReader
representing the octave process: Reads untilspacer
is 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 accordingOctaveWriterCallable
after 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 fromprocessReader
representing the octave process: Reads untilspacer
is detected which is not really read but is interpreted as an eof symbol. To that end,processReader
is wrapped into anOctaveReaderCallable.OctaveExecuteReader
with parameterspacer
which yields eof if the spacer is detected. Closing theOctaveReaderCallable.OctaveExecuteReader
reads the spacer without passing it further. Exceptions are logged onLOG
.- Specified by:
call
in interfaceCallable<Void>
- Throws:
OctaveIOException
- if underlyingreadFunctor
or the readerprocessReader
or the wrappingOctaveReaderCallable.OctaveExecuteReader
throws anIOException
.
-
-