tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > IO > How to create a temparory File

How to create a temparory File 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use FileUtil.createTempFile() API.

File Name  :  
com/bethecoder/tutorials/jodd/io/CreateTempFileTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.jodd.io;

import java.io.File;
import java.io.IOException;

import jodd.io.FileUtil;

public class CreateTempFileTest {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] argsthrows IOException {

    File tmpFile = FileUtil.createTempFile(true);
    System.out.println(tmpFile);
    
    tmpFile = FileUtil.createTempFile("abcd"".my_temp");
    System.out.println(tmpFile);
    
    tmpFile = FileUtil.createTempFile("abcd"".my_temp""C:/Test");
    System.out.println(tmpFile);
  }

}
   

It gives the following output,
C:\Documents and Settings\vsudhakar001\Local Settings\Temp\jodd-59484.tmp
C:\Documents and Settings\vsudhakar001\Local Settings\Temp\abcd59485.my_temp
C:\Test\abcd59486.my_temp



 
  


  
bl  br