ImageData data = loader.data[0];
public static void save(OutputStream os, int format, ImageLoader loader) {	if (format < 0 || format >= FORMATS.length) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);	if (FORMATS[format] == null) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);	/* We do not currently support writing multi-image files,	 * so we use the first image data in the loader's array. */	ImageData data = loader.data[0];	LEDataOutputStream stream = new LEDataOutputStream(os);	FileFormat fileFormat = null;	try {		Class clazz = Class.forName(FORMAT_PACKAGE + '.' + FORMATS[format] + FORMAT_SUFFIX);		fileFormat = (FileFormat) clazz.newInstance();	} catch (Exception e) {		SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);	}	if (format == SWT.IMAGE_BMP_RLE) {		switch (data.depth) {			case 8: fileFormat.compression = 1; break;			case 4: fileFormat.compression = 2; break;		}	}	fileFormat.unloadIntoStream(data, stream);}