]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java
2 Java class Tools contains common use procedures.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.common
;
16 import java
.text
.SimpleDateFormat
;
17 import java
.util
.Calendar
;
18 import java
.util
.Date
;
19 import java
.util
.UUID
;
22 This class contains static methods for some common operations
24 @since PackageEditor 1.0
29 get current date and time, then return
32 public static String
getCurrentDateTime() {
33 Date now
= new Date(System
.currentTimeMillis());
34 SimpleDateFormat sdf
= new SimpleDateFormat("yyyy-MM-dd HH:mm");
35 return sdf
.format(now
);
39 Delete a folder and all its files
43 public static boolean deleteFolder(File fleFolderName
) {
44 boolean blnIsDeleted
= true;
45 File
[] aryAllFiles
= fleFolderName
.listFiles();
47 for (int indexI
= 0; indexI
< aryAllFiles
.length
; indexI
++) {
49 if (aryAllFiles
[indexI
].isDirectory()) {
50 blnIsDeleted
= deleteFolder(aryAllFiles
[indexI
]);
51 } else if (aryAllFiles
[indexI
].isFile()) {
52 if (!aryAllFiles
[indexI
].delete()) {
59 fleFolderName
.delete();
69 public static String
generateUuidString() {
70 return UUID
.randomUUID().toString();