Java Path File Write nio okayToOverwrite(Path file)

Here you can find the source of okayToOverwrite(Path file)

Description

Returns true if okay to overwrite a file ("cp -i")

License

Open Source License

Parameter

Parameter Description
file a parameter

Declaration

public static boolean okayToOverwrite(Path file) 

Method Source Code


//package com.java2s;
import java.nio.file.*;

public class Main {
    /**/* ww  w. ja  va  2 s.c  om*/
     * Returns {@code true} if okay to overwrite a  file ("cp -i")
     * @param file
     * @return 
     */
    public static boolean okayToOverwrite(Path file) {
        String answer = System.console().readLine("overwrite %s (yes/no)? ", file);
        return (answer.equalsIgnoreCase("y") || answer.equalsIgnoreCase("yes"));
    }
}

Related

  1. compareTable(final String table, final List d1, final List d2, final BufferedWriter errors)
  2. isWritePermission(Path p)
  3. newBufferedWriter(Path path)
  4. newBufferedWriter(Path path, OpenOption... options)
  5. newGzipBufferedWriter(Path path)
  6. overwriteFile(final String newFilePath, final String oldFilePath)
  7. removeMatchingLines( final Map d1LineMap, final Path tableDir, final String table, final BufferedWriter errors)
  8. robustCheckWriteable(Path logFile)
  9. save(Object o, String path)