List of utility methods to do File Touch
void | touch(final File f) touch PrintWriter writer = new PrintWriter(f); writer.println("x"); writer.flush(); writer.close(); |
void | touch(final File f) Touch the specified file, creating if necessary. synchronized (touchLock) { if (!f.exists()) { new FileOutputStream(f, true).close(); } else { f.setLastModified(System.currentTimeMillis()); |
boolean | touch(final File file) Update the last modified time of the file to system current time if the specified file exists. return file.exists() && file.setLastModified(System.currentTimeMillis());
|
void | touch(final File file) touch if (file.exists()) { if (file.isDirectory()) { throw new IOException("File '" + file + "' exists but is a directory"); if (file.canWrite() == false) { throw new IOException("File '" + file + "' cannot be written to"); } else { ... |
void | touch(final File folder, final String fileName) Creates a file if (!folder.exists()) { folder.mkdirs(); final File touchedFile = new File(folder, fileName); FileOutputStream doneFOS = null; try { doneFOS = new FileOutputStream(touchedFile); } catch (FileNotFoundException e) { ... |
void | touch(String _filename) Erstellt eine neue Datei File file = new File(_filename); if (true) try { FileOutputStream ofs = new FileOutputStream(file); try { ofs.write('!'); } catch (IOException e) { ... |
void | touch(String answers) touch File file = new File(answers); try { file.createNewFile(); } catch (IOException e) { throw new RuntimeException(answers, e); |
void | touch(String f) touch File file = new File(f); try { if (file.createNewFile() || file.canWrite()) { return; } catch (IOException e) { throw new IOException("The file is not writable: " + f); ... |
boolean | touch(String file) Create a new empty file. return !exists(file) && (new File(file)).createNewFile(); |
boolean | touch(String file) Touches a file, so that it's timestamp is right now. long timestamp = System.currentTimeMillis(); return touch(new File(file).getAbsoluteFile(), timestamp); |