git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
in progress
[jalview.git]
/
forester
/
java
/
src
/
org
/
forester
/
util
/
ThreadedStreamHandler.java
diff --git
a/forester/java/src/org/forester/util/ThreadedStreamHandler.java
b/forester/java/src/org/forester/util/ThreadedStreamHandler.java
index
ed70e75
..
b5253eb
100644
(file)
--- a/
forester/java/src/org/forester/util/ThreadedStreamHandler.java
+++ b/
forester/java/src/org/forester/util/ThreadedStreamHandler.java
@@
-2,34
+2,34
@@
/**
* This class is intended to be used with the SystemCommandExecutor class to let
* users execute system commands from Java applications.
/**
* This class is intended to be used with the SystemCommandExecutor class to let
* users execute system commands from Java applications.
- *
+ *
* This class is based on work that was shared in a JavaWorld article named
* "When System.exec() won't". That article is available at this url:
* This class is based on work that was shared in a JavaWorld article named
* "When System.exec() won't". That article is available at this url:
- *
+ *
* http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
* http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
- *
+ *
* Documentation for this class is available at this URL:
* Documentation for this class is available at this URL:
- *
+ *
* http://devdaily.com/java/java-processbuilder-process-system-exec
* http://devdaily.com/java/java-processbuilder-process-system-exec
- *
- *
+ *
+ *
* Copyright 2010 alvin j. alexander, devdaily.com.
* Copyright 2010 alvin j. alexander, devdaily.com.
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
- *
+ *
* This program 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 Public License for more details.
* This program 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 Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Lesser Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
* Please ee the following page for the LGPL license:
* http://www.gnu.org/licenses/lgpl.txt
* Please ee the following page for the LGPL license:
* http://www.gnu.org/licenses/lgpl.txt
- *
+ *
*/
package org.forester.util;
*/
package org.forester.util;
@@
-54,7
+54,7
@@
class ThreadedStreamHandler extends Thread {
* A simple constructor for when the sudo command is not necessary.
* This constructor will just run the command you provide, without
* running sudo before the command, and without expecting a password.
* A simple constructor for when the sudo command is not necessary.
* This constructor will just run the command you provide, without
* running sudo before the command, and without expecting a password.
- *
+ *
* @param inputStream
* @param streamType
*/
* @param inputStream
* @param streamType
*/
@@
-65,9
+65,9
@@
class ThreadedStreamHandler extends Thread {
/**
* Use this constructor when you want to invoke the 'sudo' command.
* The outputStream must not be null. If it is, you'll regret it. :)
/**
* Use this constructor when you want to invoke the 'sudo' command.
* The outputStream must not be null. If it is, you'll regret it. :)
- *
+ *
* TODO this currently hangs if the admin password given for the sudo command is wrong.
* TODO this currently hangs if the admin password given for the sudo command is wrong.
- *
+ *
* @param inputStream
* @param streamType
* @param outputStream
* @param inputStream
* @param streamType
* @param outputStream
@@
-81,6
+81,13
@@
class ThreadedStreamHandler extends Thread {
sudoIsRequested = true;
}
sudoIsRequested = true;
}
+ ThreadedStreamHandler( final InputStream inputStream, final OutputStream outputStream ) {
+ this.inputStream = inputStream;
+ this.outputStream = outputStream;
+ printWriter = new PrintWriter( outputStream );
+ sudoIsRequested = false;
+ }
+
private void doSleep( final long millis ) {
try {
Thread.sleep( millis );
private void doSleep( final long millis ) {
try {
Thread.sleep( millis );