comparison dwt/graphics/ImageLoader.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 5f2e72114476
children fd9c62a2998e
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
21 import dwt.internal.Compatibility; 21 import dwt.internal.Compatibility;
22 import dwt.internal.image.FileFormat; 22 import dwt.internal.image.FileFormat;
23 23
24 import tango.core.Exception; 24 import tango.core.Exception;
25 import tango.core.Array; 25 import tango.core.Array;
26 import dwt.dwthelper.utils;
26 27
27 28
28 /** 29 /**
29 * Instances of this class are used to load images from, 30 * Instances of this class are used to load images from,
30 * and save images to, a file or stream. 31 * and save images to, a file or stream.
152 * <li>ERROR_IO - if an IO error occurs while reading from the file</li> 153 * <li>ERROR_IO - if an IO error occurs while reading from the file</li>
153 * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li> 154 * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data</li>
154 * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> 155 * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li>
155 * </ul> 156 * </ul>
156 */ 157 */
157 public ImageData[] load(char[] filename) { 158 public ImageData[] load(String filename) {
158 if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 159 if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
159 InputStream stream = null; 160 InputStream stream = null;
160 void close(){ 161 void close(){
161 try { 162 try {
162 if( stream !is null ) stream.close(); 163 if( stream !is null ) stream.close();
238 * <li>ERROR_IO - if an IO error occurs while writing to the file</li> 239 * <li>ERROR_IO - if an IO error occurs while writing to the file</li>
239 * <li>ERROR_INVALID_IMAGE - if the image data contains invalid data</li> 240 * <li>ERROR_INVALID_IMAGE - if the image data contains invalid data</li>
240 * <li>ERROR_UNSUPPORTED_FORMAT - if the image data cannot be saved to the requested format</li> 241 * <li>ERROR_UNSUPPORTED_FORMAT - if the image data cannot be saved to the requested format</li>
241 * </ul> 242 * </ul>
242 */ 243 */
243 public void save(char[] filename, int format) { 244 public void save(String filename, int format) {
244 if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 245 if (filename is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
245 OutputStream stream = null; 246 OutputStream stream = null;
246 try { 247 try {
247 stream = Compatibility.newFileOutputStream(filename); 248 stream = Compatibility.newFileOutputStream(filename);
248 } catch (IOException e) { 249 } catch (IOException e) {