From 6dfface585b41b2c2a43eb249c581cdab0b308f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 22 Dec 2009 21:23:38 +0100 Subject: [PATCH] Add temp directory. --- .../util/freenet/fcp2/ClientPutComplexDir.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java b/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java index 12d963d..1f6a43b 100644 --- a/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java +++ b/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java @@ -52,13 +52,33 @@ public class ClientPutComplexDir extends ClientPutDir { /** The total number of bytes of the payload. */ private long payloadLength = 0; + /** The temp directory to use. */ + private final String tempDirectory; + /** * Creates a new ClientPutComplexDir command with the specified identifier and URI. * @param identifier The identifier of the command * @param uri The URI of the command */ public ClientPutComplexDir(String identifier, String uri) { + this(identifier, uri, null); + } + + /** + * Creates a new ClientPutComplexDir command with the specified + * identifier and URI. + * + * @param identifier + * The identifier of the command + * @param uri + * The URI of the command + * @param tempDirectory + * The temp directory to use, or {@code null} to use the default + * temp directory + */ + public ClientPutComplexDir(String identifier, String uri, String tempDirectory) { super("ClientPutComplexDir", identifier, uri); + this.tempDirectory = tempDirectory; } /** @@ -69,7 +89,7 @@ public class ClientPutComplexDir extends ClientPutDir { if (fileEntry instanceof DirectFileEntry) { if (payloadFile == null){ try { - payloadFile = File.createTempFile("payload", ".dat"); + payloadFile = File.createTempFile("payload", ".dat", (tempDirectory != null) ? new File(tempDirectory) : null); payloadFile.deleteOnExit(); } catch (IOException e) { } -- 2.7.4