Changeset 8265
- Timestamp:
- 2004-10-11T09:57:37+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r8251 r8265 182 182 } 183 183 184 /** Takes a rfc2616 'safe' String and translates it back into its 'unsafe' form. Basically the native c wget decode_string() function, but without pointer stuff. If searches through the String looking for the pattern %xy where x and y are hexidecimal digits and where xy maps to a character.<BR> If x or y are not hexidecimal or % is followed by a \0 then the pattern is left as is.185 * @param encoded The url-safe <strong>String</strong> to be decoded.186 * @return The decoded <strong>String</strong>.187 */188 /* private static String decodeString(String encoded) {189 String decoded = "";190 for(int i = 0; i < encoded.length(); i++) {191 if(encoded.charAt(i) == '%') {192 if(hexidecimal(encoded.charAt(i+1)) != -1193 && hexidecimal(encoded.charAt(i+2)) != -1) {194 char unsafe_chr = (char)195 ((hexidecimal(encoded.charAt(i+1)) * 16) +196 hexidecimal(encoded.charAt(i+2)));197 decoded = decoded + unsafe_chr;198 i = i + 2;199 }200 }201 else {202 decoded = decoded + encoded.charAt(i);203 }204 }205 return decoded;206 } */207 184 208 185 /** It turns out that in Java you have to make sure a directory is empty before you delete it (much like unix I suppose), and so just like unix I'll have to set up a recursive delete function. … … 963 940 964 941 965 966 967 968 /* static private File getRecycleDirectory() {969 return new File(RECYCLE);970 } */971 972 973 942 static public String getSitesDir(String gsdl3_path) { 974 943 return gsdl3_path + File.separator + "web" … … 976 945 977 946 } 978 /** Determine whether a character is a hexidecimal one. 979 * @param chr The <i>char</i> in question. 980 * @return An <i>int</i> representing the value of the hexidecimal character or -1 if not a hexidecimal. 981 */ 982 // static private int hexidecimal(char chr) { 983 // switch(chr) { 984 // case '0': 985 // return 0; 986 // case '1': 987 // return 1; 988 // case '2': 989 // return 2; 990 // case '3': 991 // return 3; 992 // case '4': 993 // return 4; 994 // case '5': 995 // return 5; 996 // case '6': 997 // return 6; 998 // case '7': 999 // return 7; 1000 // case '8': 1001 // return 8; 1002 // case '9': 1003 // return 9; 1004 // case 'A': 1005 // return 10; 1006 // case 'B': 1007 // return 11; 1008 // case 'C': 1009 // return 12; 1010 // case 'D': 1011 // return 13; 1012 // case 'E': 1013 // return 14; 1014 // case 'F': 1015 // return 15; 1016 // default: 1017 // return -1; 1018 // } 1019 // } 947 1020 948 1021 949 /** returns the path to the greenstone version of wget */
Note:
See TracChangeset
for help on using the changeset viewer.