14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.oracle.tools.packager;
27
28 import com.oracle.tools.packager.Log;
29 import java.io.*;
30 import java.net.URL;
31 import java.nio.channels.FileChannel;
32 import java.util.Arrays;
33
34 public class IOUtils {
35
36 public static boolean deleteRecursive(File path) throws FileNotFoundException {
37 boolean ret = true;
38 if (!path.exists()) { //nothing to do
39 return true;
40 }
41 if (path.isDirectory()) {
42 File[] children = path.listFiles();
43 if (children != null) {
44 for (File f : children) {
45 ret = ret && deleteRecursive(f);
46 }
47 }
48 }
49 return ret && path.delete();
50 }
51
52 public static void copyFromURL(URL location, File file) throws IOException {
53 copyFromURL(location, file, false);
|
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.oracle.tools.packager;
27
28 import com.oracle.tools.packager.Log;
29 import java.io.*;
30 import java.net.URL;
31 import java.nio.channels.FileChannel;
32 import java.util.Arrays;
33
34 @Deprecated
35 public class IOUtils {
36
37 public static boolean deleteRecursive(File path) throws FileNotFoundException {
38 boolean ret = true;
39 if (!path.exists()) { //nothing to do
40 return true;
41 }
42 if (path.isDirectory()) {
43 File[] children = path.listFiles();
44 if (children != null) {
45 for (File f : children) {
46 ret = ret && deleteRecursive(f);
47 }
48 }
49 }
50 return ret && path.delete();
51 }
52
53 public static void copyFromURL(URL location, File file) throws IOException {
54 copyFromURL(location, file, false);
|