Here you can find the source of rename(File aFile, File dest)
aFile
.
Parameter | Description |
---|---|
aFile | The file to be renamed. |
dest | The new abstract pathname for the named file |
Parameter | Description |
---|---|
IOException | if the the renaming was not successful. |
public static void rename(File aFile, File dest) throws IOException
//package com.java2s; import java.io.File; import java.io.IOException; public class Main { /**/* www .ja v a 2 s . c om*/ * Renames the file <code>aFile</code>. * * @param aFile The file to be renamed. * @param dest The new abstract pathname for the named file * @throws IOException if the the renaming was not successful. */ public static void rename(File aFile, File dest) throws IOException { if (!aFile.renameTo(dest)) { throw new IOException("Failed to rename " + aFile + " to " + dest); } } }