Mercurial > projects > dwt-win
comparison dwt/internal/Compatibility.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 57151e2793a2 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | 2 * Copyright (c) 2000, 2006 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
26 public import dwt.dwthelper.InflaterInputStream; | 26 public import dwt.dwthelper.InflaterInputStream; |
27 | 27 |
28 import Math = tango.math.Math; | 28 import Math = tango.math.Math; |
29 import Unicode = tango.text.Unicode; | 29 import Unicode = tango.text.Unicode; |
30 import tango.sys.Process; | 30 import tango.sys.Process; |
31 import dwt.dwthelper.utils; | |
31 | 32 |
32 /** | 33 /** |
33 * This class is a placeholder for utility methods commonly | 34 * This class is a placeholder for utility methods commonly |
34 * used on J2SE platforms but not supported on some J2ME | 35 * used on J2SE platforms but not supported on some J2ME |
35 * profiles. | 36 * profiles. |
161 * | 162 * |
162 * @param filename the name of the file to open | 163 * @param filename the name of the file to open |
163 * @return a stream on the file if it could be opened. | 164 * @return a stream on the file if it could be opened. |
164 * @exception IOException | 165 * @exception IOException |
165 */ | 166 */ |
166 public static InputStream newFileInputStream(char[] filename) { | 167 public static InputStream newFileInputStream(String filename) { |
167 return new FileInputStream(filename); | 168 return new FileInputStream(filename); |
168 } | 169 } |
169 | 170 |
170 /** | 171 /** |
171 * Open a file if such things are supported. | 172 * Open a file if such things are supported. |
172 * | 173 * |
173 * @param filename the name of the file to open | 174 * @param filename the name of the file to open |
174 * @return a stream on the file if it could be opened. | 175 * @return a stream on the file if it could be opened. |
175 * @exception IOException | 176 * @exception IOException |
176 */ | 177 */ |
177 public static OutputStream newFileOutputStream(char[] filename) { | 178 public static OutputStream newFileOutputStream(String filename) { |
178 return new FileOutputStream(filename); | 179 return new FileOutputStream(filename); |
179 } | 180 } |
180 | 181 |
181 /** | 182 /** |
182 * Create an InflaterInputStream if such things are supported. | 183 * Create an InflaterInputStream if such things are supported. |
241 * @param prog the name of the program to execute | 242 * @param prog the name of the program to execute |
242 * | 243 * |
243 * @exception ProcessException | 244 * @exception ProcessException |
244 * if the program cannot be executed | 245 * if the program cannot be executed |
245 */ | 246 */ |
246 public static void exec(char[] prog) { | 247 public static void exec(String prog) { |
247 auto proc = new Process( prog ); | 248 auto proc = new Process( prog ); |
248 proc.execute; | 249 proc.execute; |
249 } | 250 } |
250 | 251 |
251 /** | 252 /** |
258 * @param progArray array containing the program to execute and its arguments | 259 * @param progArray array containing the program to execute and its arguments |
259 * | 260 * |
260 * @exception ProcessException | 261 * @exception ProcessException |
261 * if the program cannot be executed | 262 * if the program cannot be executed |
262 */ | 263 */ |
263 public static void exec(char[][] progArray) { | 264 public static void exec(String[] progArray) { |
264 auto proc = new Process( progArray ); | 265 auto proc = new Process( progArray ); |
265 proc.execute; | 266 proc.execute; |
266 } | 267 } |
267 /++ PORTING_LEFT | 268 /++ PORTING_LEFT |
268 private static ResourceBundle msgs = null; | 269 private static ResourceBundle msgs = null; |
339 * | 340 * |
340 * @param s1 string | 341 * @param s1 string |
341 * @param s2 string | 342 * @param s2 string |
342 * @return true if the two instances of class String are equal | 343 * @return true if the two instances of class String are equal |
343 */ | 344 */ |
344 public static bool equalsIgnoreCase(char[] s1, char[] s2) { | 345 public static bool equalsIgnoreCase(String s1, String s2) { |
345 char[] s1b = new char[ s1.length ]; | 346 String s1b = new char[ s1.length ]; |
346 char[] s2b = new char[ s1.length ]; | 347 String s2b = new char[ s1.length ]; |
347 scope(exit){ | 348 scope(exit){ |
348 delete s1b; | 349 delete s1b; |
349 delete s2b; | 350 delete s2b; |
350 } | 351 } |
351 char[] s1c = Unicode.toFold( s1, s1b ); | 352 String s1c = Unicode.toFold( s1, s1b ); |
352 char[] s2c = Unicode.toFold( s2, s2b ); | 353 String s2c = Unicode.toFold( s2, s2b ); |
353 return s1c == s2c; | 354 return s1c == s2c; |
354 } | 355 } |
355 | 356 |
356 } | 357 } |