Android Open Source - Exif-Editor Ega File System






From Project

Back to project page Exif-Editor.

License

The source code is released under:

MIT License

If you think the Android project Exif-Editor listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * @user https://github.com/Egatuts// w w  w. ja  va 2s  .c o m
 * @repo https://github.com/Egatuts/Exif-Editor.git
 * @file https://github.com/Egatuts/Exif-Editor/blob/master/src/git/egatuts/android/FileUtils/EgaFileSystem.java
 * @package git.egatuts.android.FileUtils
 * @license MIT (http://www.opensource.org/licenses/MIT)
 */
package git.egatuts.android.FileUtils;

import java.io.File;
import java.io.IOException;

import android.app.Activity;

import org.apache.commons.io.FileUtils;

import git.egatuts.android.utils.EgaActivityManager;

/**
 * File system management class.
 * @author Esa Garca
 * @author EgaTuts
 * @version 1.0.0
 * @created 25/8/2014 at 16:12:33.
 */
public class EgaFileSystem extends EgaFileSystemBase
{
  
  /**
   * The instance reference.
   */
  private static volatile EgaFileSystem instance = null;
  
  /**
   * Protected constructor.
   */
  protected EgaFileSystem () {}
  
  /**
   * Gets the EgaFileSystem instance using lazy initialization.
   * @return One-time initialization EgaFileSystem instance.
   */
  public static EgaFileSystem getSingleton ()
  {
    if (instance == null) instance = new EgaFileSystem();
    return instance;
  }
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#getActivity()
   */
  @Override
  public Activity getActivity ()
  {
    return EgaActivityManager.getActivity();
  }
  
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#copyFile(java.io.File, java.io.File)
   */
  @Override
  public void copyFile (File from, File to) throws IOException
  {
    FileUtils.copyFile(from, to);
  } 
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#copyFile(java.lang.String, java.lang.String)
   */
  @Override
  public void copyFile (String from, String to) throws IOException
  {
    copyFile(new File(from), new File(to));
  }
  
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#deleteFile(java.io.File)
   */
  @Override
  public void deleteFile (File file) throws IOException
  {
    File deletedName = new File(file.getAbsolutePath() + System.currentTimeMillis());
    file.renameTo(deletedName);
    if (!file.isFile()) {
      file.delete();
      return;
    }
    FileUtils.deleteDirectory(file);
  }
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#deleteFile(java.lang.String)
   */
  @Override
  public void deleteFile (String filepath) throws IOException
  {
    deleteFile(new File(filepath));
  }
  
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#moveFile(java.io.File, java.io.File)
   */
  @Override
  public void moveFile (File from, File to) throws IOException
  {
    copyFile(from, to);
    deleteFile(from);
  }
  
  /**
   * (non-Javadoc)
   * @see git.egatuts.android.FileUtils.EgaFileSystemBase#moveFile(java.lang.String, java.lang.String)
   */
  @Override
  public void moveFile (String from, String to) throws IOException
  {
    moveFile(new File(from), new File(to));
  }
  
}




Java Source Code List

git.egatuts.android.FileUtils.EgaCursorLoader.java
git.egatuts.android.FileUtils.EgaFileSystemBase.java
git.egatuts.android.FileUtils.EgaFileSystem.java
git.egatuts.android.FileUtils.EgaStorageUtils.java
git.egatuts.android.fragment.EgaFragmentActivityBase.java
git.egatuts.android.fragment.EgaFragmentActivity.java
git.egatuts.android.utils.EgaActivityManager.java
git.egatuts.exifeditor.MainActivity.java