diff options
author | lhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-31 16:26:40 +0000 |
---|---|---|
committer | lhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-31 16:26:40 +0000 |
commit | 808def96aa4589fba9c2d0ea55837754a3b7a4f7 (patch) | |
tree | 0ea221c59abb2474c694e7ab5bd61006be77e47e /Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java | |
parent | 9216450d1143056a50a5f916984a2d7faf590488 (diff) | |
download | edk2-platforms-808def96aa4589fba9c2d0ea55837754a3b7a4f7.tar.xz |
Retiring the ANT/JAVA build and removing the older EDK II packages that required ANT/JAVA.
Last Ant/Java build was r7166
Developers requiring the Java/Ant packages should checkout the branch from:
https://edk2.tianocore.org/svn/edk2/branches/AntJava
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7168 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java')
-rw-r--r-- | Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java | 193 |
1 files changed, 0 insertions, 193 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java deleted file mode 100644 index 7f15de8f89..0000000000 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/FileOperation.java +++ /dev/null @@ -1,193 +0,0 @@ -/** @file
-
- The file is used to provides interfaces for file operations
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.common;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-
-public class FileOperation {
-
- /**
-
- @param args
- * @throws Exception
-
- **/
- public static void main(String[] args) throws Exception {
- FileOperation.newFolder("C:\\aaa\\aaa\\aaa\\aaa\\aaa");
- }
-
- /**
- To new a folder
-
- @param folderPath The folder path to be created
- @throws Exception
-
- **/
- public static void newFolder(String folderPath) throws Exception {
- folderPath = Tools.convertPathToCurrentOsType(folderPath);
- File f = new File(folderPath);
- f.mkdirs();
- }
-
- /**
- Delete a file
-
- @param filePath The file path to be deleted
- @throws Exception
-
- **/
- public static void delFile(String filePath) throws Exception {
- File f = new File(filePath);
- if (f.exists()) {
- f.delete();
- }
- }
-
- /**
- Delete a folder and all its files
-
- @param filePath The name of the folder which need be deleted
- @throws Exception
-
- **/
- public static void delFolder(String filePath) throws Exception {
- File f = new File(filePath);
- if (!f.exists()) {
- return;
- }
- if (!f.isDirectory()) {
- return;
- }
- delFolder(f);
- }
-
- /**
- Delete a folder and all its files
-
- @param fleFolderName The name of the folder which need be deleted
-
- @retval true - Delete successfully
- @retval false - Delete successfully
-
- **/
- private static boolean delFolder(File fileName) throws Exception {
- boolean blnIsDeleted = true;
-
- File[] aryAllFiles = fileName.listFiles();
-
- for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {
- if (blnIsDeleted) {
- if (aryAllFiles[indexI].isDirectory()) {
- //
- //If is a directory, recursively call this function to delete sub folders
- //
- blnIsDeleted = delFolder(aryAllFiles[indexI]);
- } else if (aryAllFiles[indexI].isFile()) {
- //
- //If is a file, delete it
- //
- if (!aryAllFiles[indexI].delete()) {
- blnIsDeleted = false;
- }
- }
- }
- }
- if (blnIsDeleted) {
- fileName.delete();
- }
- return blnIsDeleted;
- }
-
- /**
- Copy a file
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFile(String oldPath, String newPath) throws Exception {
- oldPath = Tools.convertPathToCurrentOsType(oldPath);
- newPath = Tools.convertPathToCurrentOsType(newPath);
-
- int byteCount = 0;
- File oldFile = new File(oldPath);
-
- File newFile = new File(Tools.getFilePathOnly(newPath));
- if (!newFile.exists()) {
- newFolder(Tools.getFilePathOnly(newPath));
- }
-
- if (oldFile.exists()) {
- InputStream is = new FileInputStream(oldPath);
- FileOutputStream fos = new FileOutputStream(newPath);
- byte[] buffer = new byte[1024];
-
- while ((byteCount = is.read(buffer)) != -1) {
- fos.write(buffer, 0, byteCount);
- }
-
- is.close();
- }
- }
-
- /**
- Copy a folder
-
- @param oldPath
- @param newPath
- @throws Exception
-
- **/
- public static void copyFolder(String oldPath, String newPath) throws Exception {
- File oldFile = new File(oldPath);
-
- //
- // Create new file path first
- //
- newFolder(newPath);
-
- String[] files = oldFile.list();
- File temp = null;
- for (int index = 0; index < files.length; index++) {
- if (oldPath.endsWith(DataType.FILE_SEPARATOR)) {
- temp = new File(oldPath + files[index]);
- } else {
- temp = new File(oldPath + DataType.FILE_SEPARATOR + files[index]);
- }
-
- if (temp.isFile()) {
- FileInputStream fis = new FileInputStream(temp);
- FileOutputStream fos = new FileOutputStream(newPath + DataType.FILE_SEPARATOR
- + (temp.getName()).toString());
- byte[] b = new byte[1024 * 5];
- int len;
- while ((len = fis.read(b)) != -1) {
- fos.write(b, 0, len);
- }
- fos.flush();
- fos.close();
- fis.close();
- }
- if (temp.isDirectory()) {
- copyFolder(oldPath + DataType.FILE_SEPARATOR + files[index], newPath + DataType.FILE_SEPARATOR
- + files[index]);
- }
- }
- }
-}
|