X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Futil%2Ffreenet%2Ffcp2%2FConnection.java;h=951b534c97e630e38e706634c756cdfadae774f5;hb=4307e3f23f6b88b68e4e5db1dcc54d5f1e04193e;hp=9c6b74db14e5b4b7fd4fc8cb0fd2262c7f09e291;hpb=6dfface585b41b2c2a43eb249c581cdab0b308f4;p=jSite.git diff --git a/src/de/todesbaum/util/freenet/fcp2/Connection.java b/src/de/todesbaum/util/freenet/fcp2/Connection.java index 9c6b74d..951b534 100644 --- a/src/de/todesbaum/util/freenet/fcp2/Connection.java +++ b/src/de/todesbaum/util/freenet/fcp2/Connection.java @@ -71,6 +71,9 @@ public class Connection { /** The NodeHello message sent by the node on connect. */ protected Message nodeHello; + /** The temp directory to use. */ + private String tempDirectory; + /** * Creates a new connection to the specified node with the specified name. * @@ -137,6 +140,17 @@ public class Connection { } /** + * Sets the temp directory to use for creation of temporary files. + * + * @param tempDirectory + * The temp directory to use, or {@code null} to use the default + * temp directory + */ + public void setTempDirectory(String tempDirectory) { + this.tempDirectory = tempDirectory; + } + + /** * Connects to the node. * * @return true if the connection succeeded and the node @@ -313,7 +327,7 @@ public class Connection { /* need to read message from stream now */ File tempFile = null; try { - tempFile = File.createTempFile("fcpv2", "data"); + tempFile = File.createTempFile("fcpv2", "data", (tempDirectory != null) ? new File(tempDirectory) : null); tempFile.deleteOnExit(); FileOutputStream tempFileOutputStream = new FileOutputStream(tempFile); long dataLength = Long.parseLong(message.get("DataLength"));