diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
index c79f06f39b67cd7b990e92eb0d8dd6ada77f436a..f19dcfea45623ab94b7fc0f0f8f0f58a8b06c366 100644
--- a/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
+++ b/common/source/java/ch/systemsx/cisd/common/utilities/FileUtilities.java
@@ -42,6 +42,7 @@ import java.util.regex.Pattern;
 import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.CharUtils;
+import org.apache.commons.lang.RandomStringUtils;
 import org.apache.commons.lang.StringUtils;
 
 import ch.systemsx.cisd.common.exceptions.CheckedExceptionTunnel;
@@ -1054,4 +1055,35 @@ public final class FileUtilities
         }
     }
 
+    /**
+     * Create a temporary file in a given directory.
+     * <p>
+     * The file denoted by the returned abstract pathname did not exist before this method was
+     * invoked, any subsequent invocation of this method will yield a different file name.
+     * </p>
+     * <p>
+     * The filename is prefixNNNNsuffix where NNNN is a random number.
+     * </p>
+     * <p>
+     * This method is different from File.createTempFile() of JDK 1.2 as it doesn't create the file
+     * itself. It uses the location pointed to by java.io.tmpdir when the parentDir attribute is
+     * null.
+     * </p>
+     */
+    public final static File createTempFile(final String prefixOrNull, final String suffixOrNull,
+            final File parentDirOrNull)
+    {
+        File result = null;
+        final String parent =
+                (parentDirOrNull == null) ? System.getProperty("java.io.tmpdir") : parentDirOrNull
+                        .getPath();
+        do
+        {
+            result =
+                    new File(parent, StringUtils.defaultString(prefixOrNull)
+                            + RandomStringUtils.randomNumeric(4)
+                            + StringUtils.defaultString(suffixOrNull));
+        } while (result.exists());
+        return result;
+    }
 }
diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesTest.java
index 5334caee52dfe767f19a311a16fc97fbad08baf0..1003a9b47b771a643c4e81d1441a4f5c7959db0b 100644
--- a/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesTest.java
+++ b/common/sourceTest/java/ch/systemsx/cisd/common/utilities/FileUtilitiesTest.java
@@ -36,6 +36,7 @@ import java.util.regex.Pattern;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.math.NumberUtils;
 import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.common.Constants;
@@ -500,4 +501,27 @@ public final class FileUtilitiesTest extends AbstractFileSystemTestCase
         assertEquals(canonicalPath, FileUtilities.normalizeFile(file).getAbsolutePath());
     }
 
+    @Test
+    public final void testCreateTempFile()
+    {
+        File file = FileUtilities.createTempFile(null, null, null);
+        assertNotNull(file);
+        assertFalse(file.exists());
+        String name = file.getName();
+        assertTrue(name.length() == 4);
+        NumberUtils.isNumber(name);
+        String prefix = System.getProperty("java.io.tmpdir");
+        assertTrue(file.getAbsolutePath().startsWith(prefix));
+        // With a prefix, suffix and a parent
+        final String filePrefix = "prefix";
+        final String fileSuffix = ".tmp";
+        file = FileUtilities.createTempFile(filePrefix, fileSuffix, workingDirectory);
+        assertNotNull(file);
+        assertFalse(file.exists());
+        assertTrue(file.getAbsolutePath().startsWith(workingDirectory.getAbsolutePath()));
+        name = file.getName();
+        assertTrue(name.startsWith(filePrefix));
+        assertTrue(name.endsWith(fileSuffix));
+        assertEquals(filePrefix.length() + fileSuffix.length() + 4, name.length());
+    }
 }