src/org/ohmage/domain/Image.java
private File saveImage(
		final Size size,
		final File destination,
		final boolean absolute)
		throws DomainException {
		
		// Create a file reference to the destination for this file.
		File fileDestination;
		// If it's a directory, create a file in the directory whose value is
		// the ID of the image and with the appropriate size extension.
		if(destination.isDirectory()) {
			fileDestination = 
				new File(
					destination.getAbsolutePath() + "/" +
					id.toString() + 
					size.getExtension());
		}
		else {
			StringBuilder destinationBuilder = 
				new StringBuilder(destination.getAbsolutePath());
			
			if(! absolute) {
				destinationBuilder.append(size.extension);
			}
			
			fileDestination = new File(destinationBuilder.toString());
		}
		
		// If the file doesn't exist, create it. If it already exists, there is
		// no point in overwriting it. Two images with the same ID should be a
		// check performed elsewhere in the system.
		if(! fileDestination.exists()) {
			writeFile(getImageData(size), fileDestination);
		}
		
		// Return the reference to the file.
		return fileDestination;
	}
/**
	 * <p>Saves a single size of this image into the desired destination.</p>
	 * 
	 * <p>If the destination is a directory, it will construct a filename for
	 * this image based on its ID and the file size. If the destination is a
	 * specific filename, it will save the image in that file. If 'absolute' is
	 * 'true', the filename will not be modified, but, if it is 'false', the
	 * filename will be appended with the size's
	 * {@link Size#getExtension() extension}.</p>
	 * 
	 * @param size The size of the image to save.
	 * 
	 * @param destination The destination to save the image's contents.
	 * 
	 * @param absolute Whether or not to append the extension onto the
	 * 				   filename.
	 * 
	 * @return The file where the image's contents were written.
	 * 
	 * @throws DomainException There was an error reading the image or writing
	 * 						   the file.
	 */
Saves a single size of this image into the desired destination.

If the destination is a directory, it will construct a filename for
this image based on its ID and the file size. If the destination is a
specific filename, it will save the image in that file.

@param size The size of the image to save.

@param destination The destination to save the image's contents.

@param absolute Whether or not to append the extension onto the
filename.

@return The file where the image's contents were written.

@throws DomainException There was an error reading the image or writing
the file.
Saves a single size of this image into the desired destination . If the destination is a directory it will construct a filename for this image based on its ID and the file size . If the destination is a specific filename it will save the image in that file . @param size The size of the image to save . @param destination The destination to save the image ' s contents . @param absolute Whether or not to append the extension onto the filename . @return The file where the image ' s contents were written . @throws DomainException There was an error reading the image or writing the file .
private File saveImage(
		final Size size,
		final File destination,
		final boolean absolute)
		throws DomainException {
		File fileDestination;
		if(destination.isDirectory()) {
			fileDestination = 
				new File(
					destination.getAbsolutePath() + "/" +
					id.toString() + 
					size.getExtension());
		}
		else {
			StringBuilder destinationBuilder = 
				new StringBuilder(destination.getAbsolutePath());
			if(! absolute) {
				destinationBuilder.append(size.extension);
			}
			fileDestination = new File(destinationBuilder.toString());
		}
		if(! fileDestination.exists()) {
			writeFile(getImageData(size), fileDestination);
		}
		return fileDestination;
	}
private File saveImage ( final Size size , final File destination , final boolean absolute ) throws DomainException { File fileDestination ; if ( destination . isDirectory ( ) ) { fileDestination = new File ( destination . getAbsolutePath ( ) + "/" + id . toString ( ) + size . getExtension ( ) ) ; } else { StringBuilder destinationBuilder = new StringBuilder ( destination . getAbsolutePath ( ) ) ; if ( ! absolute ) { destinationBuilder . append ( size . extension ) ; } fileDestination = new File ( destinationBuilder . toString ( ) ) ; } if ( ! fileDestination . exists ( ) ) { writeFile ( getImageData ( size ) , fileDestination ) ; } return fileDestination ; }
<p>Saves a single size of this image into the desired destination.</p>
<p > Saves a single size of this image into the desired destination . < / p >
// Create a file reference to the destination for this file. // If it's a directory, create a file in the directory whose value is // the ID of the image and with the appropriate size extension. // If the file doesn't exist, create it. If it already exists, there is // no point in overwriting it. Two images with the same ID should be a // check performed elsewhere in the system. // Return the reference to the file.