comparison dwt/internal/Compatibility.d @ 238:380bad9f6852

reverted char[] to String
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:42:55 +0200
parents 0f12f6bb9739
children ce446666f5a2
comparison
equal deleted inserted replaced
237:98b80b00af79 238:380bad9f6852
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language: 10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de> 11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 12 *******************************************************************************/
13 module dwt.internal.Compatibility; 13 module dwt.internal.Compatibility;
14
15 import dwt.dwthelper.utils;
14 16
15 /+ 17 /+
16 import java.io.*; 18 import java.io.*;
17 import java.text.MessageFormat; 19 import java.text.MessageFormat;
18 import java.util.MissingResourceException; 20 import java.util.MissingResourceException;
161 * 163 *
162 * @param filename the name of the file to open 164 * @param filename the name of the file to open
163 * @return a stream on the file if it could be opened. 165 * @return a stream on the file if it could be opened.
164 * @exception IOException 166 * @exception IOException
165 */ 167 */
166 public static InputStream newFileInputStream(char[] filename) { 168 public static InputStream newFileInputStream(String filename) {
167 return new FileInputStream(filename); 169 return new FileInputStream(filename);
168 } 170 }
169 171
170 /** 172 /**
171 * Open a file if such things are supported. 173 * Open a file if such things are supported.
172 * 174 *
173 * @param filename the name of the file to open 175 * @param filename the name of the file to open
174 * @return a stream on the file if it could be opened. 176 * @return a stream on the file if it could be opened.
175 * @exception IOException 177 * @exception IOException
176 */ 178 */
177 public static OutputStream newFileOutputStream(char[] filename) { 179 public static OutputStream newFileOutputStream(String filename) {
178 return new FileOutputStream(filename); 180 return new FileOutputStream(filename);
179 } 181 }
180 182
181 /** 183 /**
182 * Create an InflaterInputStream if such things are supported. 184 * Create an InflaterInputStream if such things are supported.
241 * @param prog the name of the program to execute 243 * @param prog the name of the program to execute
242 * 244 *
243 * @exception ProcessException 245 * @exception ProcessException
244 * if the program cannot be executed 246 * if the program cannot be executed
245 */ 247 */
246 public static void exec(char[] prog) { 248 public static void exec(String prog) {
247 auto proc = new Process( prog ); 249 auto proc = new Process( prog );
248 proc.execute; 250 proc.execute;
249 } 251 }
250 252
251 /** 253 /**
258 * @param progArray array containing the program to execute and its arguments 260 * @param progArray array containing the program to execute and its arguments
259 * 261 *
260 * @exception ProcessException 262 * @exception ProcessException
261 * if the program cannot be executed 263 * if the program cannot be executed
262 */ 264 */
263 public static void exec(char[][] progArray) { 265 public static void exec(String[] progArray) {
264 auto proc = new Process( progArray ); 266 auto proc = new Process( progArray );
265 proc.execute; 267 proc.execute;
266 } 268 }
267 /++ PORTING_LEFT 269 /++ PORTING_LEFT
268 private static ResourceBundle msgs = null; 270 private static ResourceBundle msgs = null;
339 * 341 *
340 * @param s1 string 342 * @param s1 string
341 * @param s2 string 343 * @param s2 string
342 * @return true if the two instances of class String are equal 344 * @return true if the two instances of class String are equal
343 */ 345 */
344 public static bool equalsIgnoreCase(char[] s1, char[] s2) { 346 public static bool equalsIgnoreCase(String s1, String s2) {
345 char[] s1b = new char[ s1.length ]; 347 String s1b = new char[ s1.length ];
346 char[] s2b = new char[ s1.length ]; 348 String s2b = new char[ s1.length ];
347 scope(exit){ 349 scope(exit){
348 delete s1b; 350 delete s1b;
349 delete s2b; 351 delete s2b;
350 } 352 }
351 char[] s1c = Unicode.toFold( s1, s1b ); 353 String s1c = Unicode.toFold( s1, s1b );
352 char[] s2c = Unicode.toFold( s2, s2b ); 354 String s2c = Unicode.toFold( s2, s2b );
353 return s1c == s2c; 355 return s1c == s2c;
354 } 356 }
355 357
356 } 358 }