comparison servlet/src/digilib/io/FileOps.java @ 152:f4a5cfe37469

Servlet version 1.16a1 - cleanup of DigilibConfig class - now uses new Parameter and ParameterMap classes - new parameter default-quality
author robcast
date Wed, 03 Sep 2003 00:54:38 +0200
parents a398fc09ba71
children e743b853efca
comparison
equal deleted inserted replaced
151:bc8df0133c04 152:f4a5cfe37469
76 public static Iterator getImageExtensionIterator() { 76 public static Iterator getImageExtensionIterator() {
77 return Arrays.asList(fileExtensions).iterator(); 77 return Arrays.asList(fileExtensions).iterator();
78 } 78 }
79 79
80 /** 80 /**
81 * convert a string with a list of pathnames into an array of strings
82 * using the system's path separator string
83 */
84 public static String[] pathToArray(String paths) {
85 // split list into directories
86 StringTokenizer dirs =
87 new StringTokenizer(paths, File.pathSeparator);
88 int n = dirs.countTokens();
89 if (n < 1) {
90 return null;
91 }
92 // add directories into array
93 String[] pathArray = new String[n];
94 for (int i = 0; i < n; i++) {
95 String s = dirs.nextToken();
96 // make shure the dir name ends with a directory separator
97 if (s.endsWith(File.separator)) {
98 pathArray[i] = s;
99 } else {
100 pathArray[i] = s + File.separator;
101 }
102 }
103 return pathArray;
104 }
105
106 /**
81 * get a filehandle for a file or directory name 107 * get a filehandle for a file or directory name
82 * returns File number n if fn is directory (starts with 1) 108 * returns File number n if fn is directory (starts with 1)
83 */ 109 */
84 public File getFile(String fn, int n) throws FileOpException { 110 public File getFile(String fn, int n) throws FileOpException {
85 util.dprintln(4, "getFile (" + fn + ", " + n + ")"); 111 util.dprintln(4, "getFile (" + fn + ", " + n + ")");