move File - Android java.io

Android examples for java.io:File Move

Description

move File

Demo Code

import java.io.File;

public class Main {

  /**//from  w ww . j a va 2s.  c o  m
   * Write the specified data to an specified file.
   * 
   * @param file
   *          The file to write into.
   * @param data
   *          The data to write. May be null.
   */
  public static final void moveFile(final File srcFile, final File destFile) {
    if (null == srcFile) {
      throw new IllegalArgumentException("srcFile may not be null.");
    }
    if (null == destFile) {
      throw new IllegalArgumentException("destFile may not be null.");
    }
    srcFile.renameTo(destFile);
  }

}

Related Tutorials