public abstract class DaemonizedStringIOCommand extends Object implements Command<String,String>
Constructor and Description |
---|
DaemonizedStringIOCommand(String[] cmd,
String dir,
Map<String,String> environment,
int timeOut,
int startWait,
int restartwait,
int bufSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close()
Close the process.
|
protected String |
doGetNextResult() |
protected String |
doGetNextResult(boolean includeDelim) |
protected void |
doPut(String input)
Write input to stdin of the target.
|
protected abstract String |
getDelimiter() |
abstract String |
getNextResult() |
void |
put(String input) |
void |
start()
Invoke a process,and initialize thread pools.
|
protected String doGetNextResult() throws InterruptedException, IOException
InterruptedException
IOException
protected void doPut(String input)
input
- Input stringpublic void start() throws IOException
start
in interface Command<String,String>
IOException
- Target command not found / Failed to start a processpublic void close() throws IOException
close
in interface Command<String,String>
IOException
- Failed to closepublic abstract String getNextResult() throws InterruptedException, IOException
getNextResult
in interface Command<String,String>
InterruptedException
IOException
public void put(String input) throws IOException
put
in interface Command<String,String>
IOException
protected abstract String getDelimiter()
protected String doGetNextResult(boolean includeDelim) throws InterruptedException, IOException
InterruptedException
IOException
Copyright (C) 2014 Information Analysis Laboratory, NICT
RaSC is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2.1 of the License, or (at your option) any later version.
RaSC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see (http://www.gnu.org/licenses/) .