Mercurial > projects > dwt-linux
comparison dwt/internal/Compatibility.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 380bad9f6852 |
children | c0d810de7093 |
comparison
equal
deleted
inserted
replaced
239:06a1f6829310 | 240:ce446666f5a2 |
---|---|
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 |
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 | 14 |
15 import dwt.dwthelper.utils; | 15 import dwt.dwthelper.utils; |
16 | |
17 /+ | 16 /+ |
18 import java.io.*; | 17 import java.io.File; |
19 import java.text.MessageFormat; | 18 import java.text.MessageFormat; |
20 import java.util.MissingResourceException; | 19 import java.util.MissingResourceException; |
21 import java.util.ResourceBundle; | 20 import java.util.ResourceBundle; |
21 import java.util.zip.DeflaterOutputStream; | |
22 import java.util.zip.InflaterInputStream; | 22 import java.util.zip.InflaterInputStream; |
23 +/ | 23 +/ |
24 | 24 |
25 import dwt.DWT; | 25 import dwt.DWT; |
26 public import dwt.dwthelper.FileInputStream; | 26 public import dwt.dwthelper.FileInputStream; |
27 public import dwt.dwthelper.FileOutputStream; | 27 public import dwt.dwthelper.FileOutputStream; |
28 public import dwt.dwthelper.InflaterInputStream; | 28 public import dwt.dwthelper.InflaterInputStream; |
29 import dwt.dwthelper.BufferedInputStream; | |
29 | 30 |
30 import Math = tango.math.Math; | 31 import Math = tango.math.Math; |
31 import Unicode = tango.text.Unicode; | 32 import Unicode = tango.text.Unicode; |
32 import tango.sys.Process; | 33 import tango.sys.Process; |
33 | 34 |
108 public static int ceil(int p, int q) { | 109 public static int ceil(int p, int q) { |
109 return cast(int)Math.ceil(cast(float)p / q); | 110 return cast(int)Math.ceil(cast(float)p / q); |
110 } | 111 } |
111 | 112 |
112 /** | 113 /** |
114 * Answers whether the indicated file exists or not. | |
115 * | |
116 * @param parent the file's parent directory | |
117 * @param child the file's name | |
118 * @return true if the file exists | |
119 */ | |
120 public static bool fileExists(String parent, String child) { | |
121 return (new File (parent, child)).exists(); | |
122 } | |
123 | |
124 /** | |
113 * Answers the most positive (i.e. closest to positive infinity) | 125 * Answers the most positive (i.e. closest to positive infinity) |
114 * integer value which is less than the number obtained by dividing | 126 * integer value which is less than the number obtained by dividing |
115 * the first argument p by the second argument q. | 127 * the first argument p by the second argument q. |
116 * | 128 * |
117 * @param p numerator | 129 * @param p numerator |
154 return 2 << (n - 1); | 166 return 2 << (n - 1); |
155 else if (n != 0) { | 167 else if (n != 0) { |
156 DWT.error(DWT.ERROR_INVALID_RANGE); | 168 DWT.error(DWT.ERROR_INVALID_RANGE); |
157 } | 169 } |
158 return 1; | 170 return 1; |
171 } | |
172 | |
173 /** | |
174 * Create an DeflaterOutputStream if such things are supported. | |
175 * | |
176 * @param stream the output stream | |
177 * @return a deflater stream or <code>null</code> | |
178 * @exception IOException | |
179 * | |
180 * @since 3.4 | |
181 */ | |
182 public static OutputStream newDeflaterOutputStream(OutputStream stream) { | |
183 implMissing(__FILE__,__LINE__); | |
184 return null; | |
185 //DWT_TODO return new DeflaterOutputStream(stream); | |
159 } | 186 } |
160 | 187 |
161 /** | 188 /** |
162 * Open a file if such things are supported. | 189 * Open a file if such things are supported. |
163 * | 190 * |