public static void touch(File file) throws IOException {
  if (!file.exists()) {
    OutputStream out=openOutputStream(file);
    IOUtils.closeQuietly(out);
  }
  boolean success=file.setLastModified(System.currentTimeMillis());
  if (!success) {
    throw new IOException("Unable to set the last modification time for " + file);
  }
}

public static void touch ( File file ) throws IOException { if ( ! file . exists ( ) ) { OutputStream out = openOutputStream ( file ) ; IOUtils . closeQuietly ( out ) ; } boolean success = file . setLastModified ( System . currentTimeMillis ( ) ) ; if ( ! success ) { throw new IOException ( "Unable to set the last modification time for " + file ) ; } }
implements the same behaviour as the " touch " utility on unix . it creates a new file with size 0 or , if the file exists already , it is opened and closed without modifying it , but updating the file date and time . < p > note : as from v1 . 3 , this method throws an ioexception if the last modified date of the file cannot be set . also , as from v1 . 3 this method creates parent directories if they do not exist .
