src/org/ohmage/domain/Image.java
public File saveImage(final File directory) throws DomainException {
		// This will keep track of the images as we create them.
		Map<Size, File> files = new HashMap<Size, File>();
		
		// Save the individual sizes.
		try {
			// For sizes that have already been decoded, save the file now.
			for(Size size : imageData.keySet()) {
				files.put(size, saveImage(size, directory, false));
			}
		}
		// If something happens, roll back and delete the files.
		catch(DomainException e) {
			for(File file : files.values()) {
				file.delete();
			}
			
			throw new DomainException("There was an error saving a file.", e);
		}
		
		// Return only the original file.
		return files.get(ORIGINAL);
	}
/**
	 * <p>Saves the images contents to disk in the given directory. This
	 * includes one file for each {@link Size}. The original file will be named
	 * with the  To
	 * save only a specific file size, use the
	 * {@link #saveImage(Size, File, boolean)} function. 
	 * 
	 * @param directory The location to save the original file. The different
	 * 				   file sizes will be saved in the same directory with a
	 * 				   filename of their {@link #getId() ID} and their 
	 * 				   respective {@link Size#getExtension() extensions}
	 * 				   appended.
	 *  
	 * @throws DomainException There was an error reading the image contents or
	 * 						   writing the file.
	 */
Saves the images contents to disk in the given directory. This
includes one file for each  Size. The original file will be named
with the  To
save only a specific file size, use the
#saveImage(Size, File, boolean) function.

@param directory The location to save the original file. The different
file sizes will be saved in the same directory with a
filename of their  #getId() ID and their
respective  Size#getExtension() extensions
appended.

@throws DomainException There was an error reading the image contents or
writing the file.
Saves the images contents to disk in the given directory . This includes one file for each Size . The original file will be named with the To save only a specific file size use the #saveImage ( Size File boolean ) function . @param directory The location to save the original file . The different file sizes will be saved in the same directory with a filename of their #getId () ID and their respective Size#getExtension () extensions appended . @throws DomainException There was an error reading the image contents or writing the file .
public File saveImage(final File directory) throws DomainException {
		Map<Size, File> files = new HashMap<Size, File>();
		try {
			for(Size size : imageData.keySet()) {
				files.put(size, saveImage(size, directory, false));
			}
		}
		catch(DomainException e) {
			for(File file : files.values()) {
				file.delete();
			}
			throw new DomainException("There was an error saving a file.", e);
		}
		return files.get(ORIGINAL);
	}
public File saveImage ( final File directory ) throws DomainException { Map < Size , File > files = new HashMap < Size , File > ( ) ; try { for ( Size size : imageData . keySet ( ) ) { files . put ( size , saveImage ( size , directory , false ) ) ; } } catch ( DomainException e ) { for ( File file : files . values ( ) ) { file . delete ( ) ; } throw new DomainException ( "There was an error saving a file." , e ) ; } return files . get ( ORIGINAL ) ; }
<p>Saves the images contents to disk in the given directory.
<p > Saves the images contents to disk in the given directory .
// This will keep track of the images as we create them. // Save the individual sizes. // For sizes that have already been decoded, save the file now. // If something happens, roll back and delete the files. // Return only the original file.