Changeset 7574
- Timestamp:
- 2004-06-09T11:57:51+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/util/Utility.java
r7524 r7574 890 890 return original; 891 891 } 892 893 892 894 /** Method to strip new lines and extra spaces from a string. Used to restore text that has been mangled into width formatted blocks by the DOM parser. 893 895 * @param raw_str The <strong>Strong</strong> containing the mangled text. 894 896 * @return A <strong>String</strong> with new lines and extra spaces removed. 897 * @deprecated This function makes a mess of Unicode strings. 895 898 */ 896 899 static public String stripNL(String raw_str) { … … 919 922 return new String(finish); 920 923 } 921 /** Trims the string text to the length specified removing end characters and adding if necessary. 922 * @param text A <strong>String</strong> which you wish to ensure is shorter than length. 923 * @param length An <i>int</i> specifying the strings maximum length after which its trimmed. 924 * @return The trimmed <strong>String</strong>. 925 */ 926 public static String trim(String text, int length) { 927 if(text.length() > length) { 928 text = text.substring(0, length); 929 text = text + "..."; 930 } 931 return text; 932 } 924 933 925 934 926 static public String trimCenter(String text, int length) { … … 942 934 return text; 943 935 } 944 /** This method checks to see what registered file system root directorys are mounted, and returns only accessible ones. The exception is removable media drives (in particular floppy-disk drives) which will throw all sorts of error if we test them here. Instead they are assumed to be always accessible, but a test is conducted at the time you attempt to map them to test for actual accessibility (then at least the errors are thrown after the user tries to initiate the mapping of the drive which has no disk in it).945 * @param roots A <strong>File[]</strong> containing all of the file system roots registered on this system.946 * @return A filtered <strong>File[]</strong> containing only those drives that are accessible and/or are floppy-disk media drives.947 */948 /* private static File[] validateDrives(File roots[]) {949 Vector valid = new Vector();950 for(int i = 0; i < roots.length; i++) {951 String name = roots[i].getAbsolutePath();952 name = name.toLowerCase();953 if(!name.startsWith("a:") && !name.startsWith("b:")) {954 valid.add(roots[i]);955 }956 }957 roots = new File[valid.size()];958 for(int i = 0; i < roots.length; i++) {959 roots[i] = (File)valid.get(i);960 }961 return roots;962 } */963 936 }
Note:
See TracChangeset
for help on using the changeset viewer.