Java File Touch touch(File file)

Here you can find the source of touch(File file)

Description

touch

License

Open Source License

Declaration

public static boolean touch(File file) 

Method Source Code

//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;
    }
}

Related

  1. touch(File baseDir, String... segments)
  2. touch(File f)
  3. touch(File f)
  4. touch(File file)
  5. touch(File file)
  6. touch(File file)
  7. touch(File file)
  8. touch(File file)
  9. touch(File file)