Android examples for File Input Output:File System
Implements the same behavior as the touch utility on Unix.
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { /**/*from w w w .j a v a2s .c om*/ * Implements the same behavior as the {@code touch} utility on Unix. * * @param file * The file to touch * @throws IOException */ public static void touch(final File file) throws IOException { if (!file.exists()) { file.createNewFile(); } file.setLastModified(System.currentTimeMillis()); } }