diff options
author | Eike Stepper | 2011-02-06 20:29:48 +0000 |
---|---|---|
committer | Eike Stepper | 2011-02-06 20:29:48 +0000 |
commit | 9bd484320ccbcdff537328c646bc02daabd7d4ba (patch) | |
tree | 7ed091200ebfc4604821e6909de5ed681e652b7b /plugins/org.eclipse.net4j.util/src | |
parent | f4d16c32be0d02f0e7a90d4d1ff883395ab8c378 (diff) | |
download | cdo-9bd484320ccbcdff537328c646bc02daabd7d4ba.tar.gz cdo-9bd484320ccbcdff537328c646bc02daabd7d4ba.tar.xz cdo-9bd484320ccbcdff537328c646bc02daabd7d4ba.zip |
added temp dir override
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src')
-rw-r--r-- | plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/TMPUtil.java | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/TMPUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/TMPUtil.java index 9a503fa688..08be1f0431 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/TMPUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/TMPUtil.java @@ -116,10 +116,6 @@ public final class TMPUtil public static File createTempFolder(String prefix, String suffix, File directory) throws IORuntimeException { - // TODO Consider servlets - // ServletContext context = session.getServletContext(); - // File tempDir = (File)context.getAttribute("javax.servlet.context.tempdir"); - try { File tmp = File.createTempFile(prefix, suffix, directory); @@ -134,4 +130,43 @@ public final class TMPUtil throw new IORuntimeException(ex); } } + + /** + * @since 3.1 + */ + public static File createTempFile() throws IORuntimeException + { + return createTempFile("tmp"); //$NON-NLS-1$ + } + + /** + * @since 3.1 + */ + public static File createTempFile(String prefix) throws IORuntimeException + { + return createTempFile(prefix, ""); //$NON-NLS-1$ + } + + /** + * @since 3.1 + */ + public static File createTempFile(String prefix, String suffix) throws IORuntimeException + { + return createTempFile(prefix, suffix, getTempFolder()); + } + + /** + * @since 3.1 + */ + public static File createTempFile(String prefix, String suffix, File directory) throws IORuntimeException + { + try + { + return File.createTempFile(prefix, suffix, directory); + } + catch (IOException ex) + { + throw new IORuntimeException(ex); + } + } } |