Here you can find the source of touch(File file)
public static boolean touch(File file)
//package com.java2s; import java.io.File; import java.io.FileOutputStream; public class Main { public static boolean touch(File file) { FileOutputStream fo = null; try {/* w ww . ja v a 2 s . c o m*/ fo = new FileOutputStream(file); } catch (Exception e) { return false; } finally { if (fo != null) { try { fo.flush(); } catch (Exception e) { } try { fo.close(); } catch (Exception e) { } } } return true; } }