List of utility methods to do File Touch
File | touch(File baseDir, String... segments) touch File f = baseDir; for (String segment : segments) { f = new File(f, segment); f.getParentFile().mkdirs(); f.createNewFile(); return f; |
void | touch(File f) Touch a file (see touch(1)). if (!f.exists()) { FileWriter fw = new FileWriter(f); fw.close(); } else { f.setLastModified(System.currentTimeMillis()); |
void | touch(File f) touch if (f.createNewFile()) return; f.setLastModified(System.currentTimeMillis()); |
void | touch(File file) touch touch(file, false); |
void | touch(File file) Touch a file, setting its last modified timestamp to current time if (file.exists()) { if (!file.setLastModified(System.currentTimeMillis())) { throw new IOException("Could not touch file " + file.getAbsolutePath()); } else { try { File directory = file.getParentFile(); if (!directory.exists()) { ... |
boolean | touch(File file) touch FileOutputStream fo = null; try { fo = new FileOutputStream(file); } catch (Exception e) { return false; } finally { if (fo != null) { try { ... |
void | touch(File file) Creates an empty file. new FileOutputStream(file).close();
|
void | touch(File file) Implements the same behaviour as the "touch" utility on Unix. if (!file.exists()) { OutputStream out = openOutputStream(file); closeQuietly(out); boolean success = file.setLastModified(System.currentTimeMillis()); if (!success) { throw new IOException("Unable to set the last modification time for " + file); |
void | touch(File file) Implements the same behaviour as the "touch" utility on Unix. if (!file.exists()) { OutputStream out = new FileOutputStream(file); out.close(); file.setLastModified(System.currentTimeMillis()); |
void | touch(File file) touch long timestamp = System.currentTimeMillis();
touch(file, timestamp);
|