From: David ‘Bombe’ Roden Date: Tue, 22 Dec 2009 20:23:38 +0000 (+0100) Subject: Add temp directory. X-Git-Tag: 0.8~10 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6dfface585b41b2c2a43eb249c581cdab0b308f4;p=jSite.git Add temp directory. --- 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) { }