MCPcopy Create free account
hub / github.com/antlr/codebuff / move

Method move

output/java_guava/1.4.17/Files.java:504–517  ·  view source on GitHub ↗

Moves a file from one path to another. This method can rename a file and/or move it to a different directory. In either case to must be the target path for the file itself; not just the new name for the file or the path to the new parent directory. @param from the source file @param to the

(File from, File to)

Source from the content-addressed store, hash-verified

502
503
504 public static void move(File from, File to) throws IOException {
505 checkNotNull(from);
506 checkNotNull(to);
507 checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to);
508 if (!from.renameTo(to)) {
509 copy(from, to);
510 if (!from.delete()) {
511 if (!to.delete()) {
512 throw new IOException("Unable to delete " + to);
513 }
514 throw new IOException("Unable to delete " + from);
515 }
516 }
517 }
518
519 /**
520 * Reads the first line from a file. The line does not include line-termination characters, but

Callers

nothing calls this directly

Calls 5

copyMethod · 0.95
equalsMethod · 0.65
checkNotNullMethod · 0.45
checkArgumentMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected