1 16 package net.sf.jftp.system; 17 18 import java.io.*; 19 20 21 public class LocalIO 22 { 23 27 public static String [] sortStrings(String [] array) 28 { 29 for(int i = array.length; --i >= 0;) 30 { 31 boolean swapped = false; 32 33 for(int j = 0; j < i; j++) 34 { 35 if(array[j].compareTo(array[j + 1]) > 0) 36 { 37 String T = new String (array[j]); 38 array[j] = new String (array[j + 1]); 39 array[j + 1] = new String (T); 40 swapped = true; 41 } 42 } 43 44 if(!swapped) 45 { 46 break; 47 } 48 } 49 50 return array; 51 } 52 53 54 public static void cleanLocalDir(String dir, String path) 55 { 56 if(dir.endsWith("\\")) 57 { 58 System.out.println("oops... fucked up, need to fix \\-problem!!!"); 59 } 60 61 if(!dir.endsWith("/")) 62 { 63 dir = dir + "/"; 64 } 65 66 File f2 = new File(path + dir); 69 String [] tmp = f2.list(); 70 71 for(int i = 0; i < tmp.length; i++) 72 { 73 File f3 = new File(path + dir + tmp[i]); 74 75 if(f3.isDirectory()) 76 { 77 cleanLocalDir(dir + tmp[i], path); 79 f3.delete(); 80 } 81 else 82 { 83 f3.delete(); 85 } 86 } 87 } 88 89 90 public static void pause(int time) 91 { 92 try 93 { 94 Thread.sleep(time); 95 } 96 catch(Exception ex) 97 { 98 ex.printStackTrace(); 99 } 100 } 101 } 102 | Popular Tags |