X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Futil%2Ffreenet%2Ffcp2%2FConnection.java;h=5ae344ce5a7145c161064e40b4520fab550c31e6;hb=93895a33c778a8660c7f8ea09d2566a567c1890a;hp=3fd39f6db6cc98fb1067c0931b2007e9cce4cad5;hpb=b7f534843b2766c609ce2a17caf5fe52b3b6f9a3;p=jSite.git diff --git a/src/de/todesbaum/util/freenet/fcp2/Connection.java b/src/de/todesbaum/util/freenet/fcp2/Connection.java index 3fd39f6..5ae344c 100644 --- a/src/de/todesbaum/util/freenet/fcp2/Connection.java +++ b/src/de/todesbaum/util/freenet/fcp2/Connection.java @@ -34,6 +34,7 @@ import java.util.List; import de.todesbaum.util.io.Closer; import de.todesbaum.util.io.LineInputStream; import de.todesbaum.util.io.StreamCopier; +import de.todesbaum.util.io.StreamCopier.ProgressListener; import de.todesbaum.util.io.TempFileInputStream; /** @@ -260,6 +261,22 @@ public class Connection { * if an I/O error occurs */ public synchronized void execute(Command command) throws IllegalStateException, IOException { + execute(command, null); + } + + /** + * Executes the specified command. + * + * @param command + * The command to execute + * @param progressListener + * A progress listener for a payload transfer + * @throws IllegalStateException + * if the connection is not connected + * @throws IOException + * if an I/O error occurs + */ + public synchronized void execute(Command command, ProgressListener progressListener) throws IllegalStateException, IOException { if (nodeSocket == null) { throw new IllegalStateException("connection is not connected"); } @@ -271,7 +288,7 @@ public class Connection { InputStream payloadInputStream = null; try { payloadInputStream = command.getPayload(); - StreamCopier.copy(payloadInputStream, nodeOutputStream, command.getPayloadLength()); + StreamCopier.copy(payloadInputStream, nodeOutputStream, command.getPayloadLength(), progressListener); } finally { Closer.close(payloadInputStream); }